Skip to content

Commit

Permalink
fix(#3993): do not update filelist on mount (#4002)
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem authored Nov 6, 2023
1 parent b68ef99 commit e3f1e0f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/ui/src/components/va-file-upload/VaFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default defineComponent({
},
})
const validateFiles = (files: VaFile[]) => files.filter((file) => {
const filterInvalidFiles = (files: VaFile[]) => files.filter((file) => {
const fileName = file.name || file.url
if (!fileName) { return false }
if (file.url) { return true }
Expand All @@ -163,7 +163,7 @@ export default defineComponent({
if (!f) { return }
const validatedFiles = props.fileTypes ? validateFiles(Array.from(f)) : f
const validatedFiles = props.fileTypes ? filterInvalidFiles(Array.from(f)) : f
files.value = props.type === 'single' ? (validatedFiles as VaFile[]) : [...files.value, ...validatedFiles]
Expand Down Expand Up @@ -202,7 +202,10 @@ export default defineComponent({
onMounted(() => {
if (Array.isArray(files.value)) {
files.value = validateFiles(files.value)
const filteredFiles = filterInvalidFiles(files.value)
if (filteredFiles.length !== files.value.length) {
files.value = filteredFiles
}
}
})
Expand Down

0 comments on commit e3f1e0f

Please sign in to comment.