Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix FileUploader #437

Merged
merged 2 commits into from
Dec 1, 2020
Merged

fix FileUploader #437

merged 2 commits into from
Dec 1, 2020

Conversation

AsakuraMizu
Copy link
Contributor

Related PR: #422

files should be a FileList, not a list of files' names.

@AsakuraMizu AsakuraMizu requested a review from metonym as a code owner November 30, 2020 03:16
@vercel
Copy link

vercel bot commented Nov 30, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carbon-svelte/carbon-components-svelte/jkn55rftz
✅ Preview: https://carbon-components-svelte-git-master.carbon-svelte.vercel.app

@metonym
Copy link
Collaborator

metonym commented Nov 30, 2020

Thanks for the PR.

It seems that the mismatch is because FileList type is an object of Symbol iterators (files) and spreading target.files ([...target.files]) converts it into an array.

Two options:

  1. To keep with the files: FileList type, do not spread target.files

This would require updating the rendering logic within FileUploader ({#each files as { name }, i (name)})

  1. Change files type to File[]

I'm inclined to go with option 1 because the files prop would be consistent with the native value of e.target.files.

Copy link
Collaborator

@metonym metonym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent

@metonym metonym merged commit 495ae27 into carbon-design-system:master Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants