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(ui5-file-uploader): setting the value to an empty string also res… #1715

Merged
merged 1 commit into from
Jun 2, 2020

Conversation

vladitasev
Copy link
Contributor

@vladitasev vladitasev commented Jun 2, 2020

Currently it is not possible to upload the same file twice in a row, as the change event is never fired. There are use cases when the user uploaded a file, then removed it (f.e. from the UploadCollection) and then they try to upload the same file again. However, nothing happens as no change event is fired form the native input. Even if the developer sets value to an empty string, this only affects ui5-file-uploader, but does not affect the native input in any way, so it's stuck with the old file despite the fact that ui5-file-uploader looks empty to the user.

The implementation is in onAfterRendering for a reason. The native file input's value property is read-only, but can be set to an empty string, and only to that, so it's almost like a public method. Trying to bind this property is problematic, because lit-html should never try to change it, but only to set it to an empty string, which makes it hard to keep the state up to date. Therefore it's safest to do this imperatively.

In addition: The UploadCollection sample was updated to reset the file uploader each time the user uploads a file, so they can upload the same file twice now.

closes: #1709

@vladitasev vladitasev merged commit f8b1b39 into master Jun 2, 2020
@vladitasev vladitasev deleted the file-uploader-reset branch June 2, 2020 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui5-file-uploader: unable to upload the same file twice
2 participants