디자인디테일
This commit is contained in:
@@ -79,7 +79,8 @@ export function UploadButton({ onUploaded, multiple = false, maxWidth = 1600, ma
|
||||
const { show } = useToast();
|
||||
const [loading, setLoading] = useState(false);
|
||||
async function onChange(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
const files = Array.from(e.target.files ?? []);
|
||||
const input = e.currentTarget; // React 이벤트 풀링 대비: 참조 보관
|
||||
const files = Array.from(input.files ?? []);
|
||||
if (files.length === 0) return;
|
||||
try {
|
||||
setLoading(true);
|
||||
@@ -99,7 +100,8 @@ export function UploadButton({ onUploaded, multiple = false, maxWidth = 1600, ma
|
||||
show("업로드 실패");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
e.currentTarget.value = "";
|
||||
// 선택값 초기화(같은 파일 재선택 가능하도록)
|
||||
if (input) input.value = "";
|
||||
}
|
||||
}
|
||||
return <label style={{ display: "inline-block" }}>
|
||||
|
||||
Reference in New Issue
Block a user