Skip to content

Commit

Permalink
- Fix icon rendering incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
elipe17 committed Sep 27, 2023
1 parent bb678c3 commit c997c69
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tdrs-frontend/src/components/FileUpload/FileUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ function FileUpload({ section, setLocalAlertState }) {
(file) => file.section.includes(sectionName) && file.uuid
)

const hasPreview = files?.some(
(file) => file.section.includes(sectionName) && file.name
)

const selectedFile = files?.find((file) => file.section.includes(sectionName))

const formattedSectionName = selectedFile?.section
Expand All @@ -58,8 +62,10 @@ function FileUpload({ section, setLocalAlertState }) {
setTimeout(trySettingPreview, 100)
}
}
if (hasFile) trySettingPreview()
}, [hasFile, fileName, targetClassName])
if (hasPreview) {
trySettingPreview()
}
}, [hasPreview, fileName, targetClassName])

const downloadFile = ({ target }) => {
dispatch(clearError({ section: sectionName }))
Expand Down

0 comments on commit c997c69

Please sign in to comment.