Skip to content

webrepl.html: Deselect previously selected file before reading #14

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

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

mcauser
Copy link
Contributor

@mcauser mcauser commented Aug 29, 2016

Without this, when you select a file, make modifications and select the same file again, it does not read the latest changes, as the file inputs change event does not fire.

To work around, you have to select a different file, or cancel the file dialog to clear the field's value before trying your modified file again.

Without this, if you select a file, make modifications and select the
same file again, it does not read the latest changes as the file inputs
change event does not fire. To work around, you have to select a
different file, or cancel the file dialog to clear the field value
before trying your modified file again.
@mcauser mcauser changed the title Deselect previously selected file before reading webrepl.html: Deselect previously selected file before reading Aug 29, 2016
@dpgeorge
Copy link
Member

This patch seems to work, although it's perhaps not the most elegant thing. Another option would be to load the contents of the file when the "Send to device" button is pressed, which would reload the file each time you send it. The disadvantage is that the UI can no longer tell you the size of the file before uploading.

@pfalcon
Copy link
Contributor

pfalcon commented Aug 31, 2016

This patch seems to work, although it's perhaps not the most elegant thing.

What's your concern? I had the same idea how to work around this - by explicitly resetting file selection widget to null somewhere.

@dpgeorge
Copy link
Member

What's your concern?

Just that it adds extra callbacks/events, as opposed to resetting it in a pre-existing callback/function (like once the file transfer is finished). But really, it's fine like this.

@pfalcon
Copy link
Contributor

pfalcon commented Aug 31, 2016

Ah, right, I for example would think it make sense to reset that field somewhere at the "put" operation - at the end, or likely, at the beginning of it.

@dpgeorge
Copy link
Member

But I think what's done here is the best for the user: if you select the file, but then make a change before putting, and then re-select it, the code here will reload it, which is what you want.

@pfalcon
Copy link
Contributor

pfalcon commented Aug 31, 2016

Right, so +1 from me (if it's tested to work ;-) ).

@dpgeorge dpgeorge merged commit 8ea1afd into micropython:master Aug 31, 2016
@dpgeorge
Copy link
Member

I did test it.

@mcauser mcauser deleted the send-file-reset branch September 5, 2016 01:06
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.

3 participants