Skip to content

[File uploader] Single upload reruns only once#2122

Merged
karriebear merged 2 commits intostreamlit:feature/file-uploaderfrom
karriebear:file-uploader-single-upload
Oct 8, 2020
Merged

[File uploader] Single upload reruns only once#2122
karriebear merged 2 commits intostreamlit:feature/file-uploaderfrom
karriebear:file-uploader-single-upload

Conversation

@karriebear
Copy link
Copy Markdown
Contributor

@karriebear karriebear commented Oct 8, 2020

Single file uploader should not cause 2 reruns. Previously updating on delete and on add. Now when replacing a file, delete and add is one action


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@karriebear karriebear requested a review from a team October 8, 2020 05:47
@karriebear karriebear changed the title File uploader single upload [File uploader] Single upload reruns only once Oct 8, 2020
@karriebear karriebear force-pushed the file-uploader-single-upload branch 2 times, most recently from 26fefe7 to 517c8ba Compare October 8, 2020 08:21
@karriebear karriebear force-pushed the file-uploader-single-upload branch from 517c8ba to b7df4fa Compare October 8, 2020 08:26
self.send_error(400, reason=str(e))
return

LOGGER.debug(f"{len(files)} file(s) received for session {session_id} widget {widget_id}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this something we want permanently, or will we remove this after debugging the issue Adrien encountered? (If the latter, it'd be nice to add a TODO here and below)

@@ -111,7 +111,7 @@ class FileUploader extends React.PureComponent<Props, State> {

if (!multipleFiles && this.state.files.length) {
// Only one file is allowed. Delete existing file.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this comment no longer accurate? What is the difference between "delete" and "removeFile" anyways?

Copy link
Copy Markdown
Contributor Author

@karriebear karriebear Oct 8, 2020

Choose a reason for hiding this comment

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

It's kind of accurate. delete will make the delete HTTP request and removeFile just removes it from the screen.

@@ -37,11 +37,13 @@ export class FileUploadClient extends HttpClient {
widgetId: string,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: extra space in line 35, also add "replace" to the docstring?

@karriebear karriebear merged commit 183d934 into streamlit:feature/file-uploader Oct 8, 2020
karriebear added a commit that referenced this pull request Oct 8, 2020
* File Uploader (#2013)

* Copying over

* Linting

* Missed copy - Hashing + Media support

* Sidebar UX cleanup

* Testing cleanup

* linting + cleanup

* E2E

* linting

* Fix unit tests

* Get snapshots

* Styling cleanup

* File sizing + state updating cleanup

* File sizing + state updating cleanup

* button cleanup + file deletion

* Separate dropzone instructions into a new file

* Separate dropzone instructions into a new file

* Linting

* Small/Error text styled componenting

* a11y uploaded files

* Spacing var

* Whoops + button updates

* Multile file uploader should return [] when empty

* Visual design updates

* linting/cleanup

* Revert rejectFiles change

* Fix tests

* Address PR comments

* Fix test

* addressing quick pr comments

* Whoops

* fix tests

* Readable tests

* setState with function

* [File Uploader] Update deprecation (#2123)

* Update deprecation

* Update test for deprecation

* Fix docstrings (#2121)

* [File Uploader] Missed visual tweaks (#2124)

* Quick visual tweaks

* linting

* [File uploader] Single upload reruns only once (#2122)

* Single file uploader replaces in 1 request

* Update comments
@karriebear karriebear deleted the file-uploader-single-upload branch October 15, 2020 16:40
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