Skip to content

Commit

Permalink
feat: part 이동 되어도 파일 그대로 유지하기
Browse files Browse the repository at this point in the history
  • Loading branch information
eonseok-jeon committed Aug 7, 2024
1 parent 7e310ce commit dc2d080
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/views/ApplyPage/components/FileInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr
};

useEffect(() => {
if (getValues(`file${defaultFileId}`)) return;

if (defaultFileId && defaultFileUrl && defaultFileName) {
setValue(`file${defaultFileId}`, {
file: defaultFileUrl,
Expand All @@ -137,11 +139,6 @@ const FileInput = ({ section, id, isReview, disabled, defaultFile }: FileInputPr
}

if (getValues(`file${id}`) && getValues(`${section}${id}`) === '') setValue(`${section}${id}`, '파일 제출');

return () => {
setValue(`file${id}`, undefined);
getValues(`${section}${id}`) === '파일 제출' && setValue(`${section}${id}`, '');
};
}, [section, id, defaultFileId, defaultFileUrl, defaultFileName, getValues, setValue]);

return (
Expand Down

0 comments on commit dc2d080

Please sign in to comment.