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

feat: remove uppy and use upload hooks #1295

Merged
merged 6 commits into from
Jun 26, 2024
Merged

feat: remove uppy and use upload hooks #1295

merged 6 commits into from
Jun 26, 2024

Conversation

pyphilia
Copy link
Contributor

This PR removes the use of uppy everywhere. We now use real mutations to upload files for:

  • item thumbnail: I didn't change the layout
  • h5p: a button
  • zip: a button
  • files: file drop zone

My implementation is a mixed of showing upload progress within the drop zone and toaster. The reason is that we sometimes clear the dropzone before the complete upload is finished. Here are the 3 ways we can upload files:

  • from the dropzone in the screen (when the folder is empty): use toast because the view is updated at the first item upload (websockets).
  • from new item modal: the loading is show in the dropzone, and the modal closes when it finishes
  • drop in a folder that already contains items: the dropzone disappear immediately, so the loading and errors happens in toastr.

A bug I've noticed is that the backend actually cannot handle multiple files upload (it gets stuck and never return for more than 1 file). Uploading one file is okay, and was actually working with uppy because uppy was sending one file at a time! So I faked this behavior by sending one request per file.
Something that could considered a glitch is "showing n notifications when uploading n files". This is because the notifications are triggered by query client. Personally I think it is okay, but let me know what you think.

Screenshot 2024-06-21 at 17 56 23 Screenshot 2024-06-21 at 17 44 32
Screen.Recording.2024-06-21.at.17.42.55.mov

TODO:

  • write tests

@pyphilia pyphilia self-assigned this Jun 21, 2024
@pyphilia pyphilia marked this pull request as ready for review June 24, 2024 15:18
Copy link
Member

@spaenleh spaenleh left a comment

Choose a reason for hiding this comment

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

Looks good, just a few nitpicks and comments ! Very nice !

src/components/file/FileUploader.tsx Outdated Show resolved Hide resolved
src/utils/file.ts Outdated Show resolved Hide resolved
src/components/hooks/uploadWithProgress.tsx Outdated Show resolved Hide resolved
src/components/hooks/uploadWithProgress.tsx Show resolved Hide resolved
@spaenleh
Copy link
Member

@pyphilia Does this PR also fix some of the issues highlighted in #572 ?

@pyphilia pyphilia mentioned this pull request Jun 26, 2024
3 tasks
@pyphilia pyphilia enabled auto-merge June 26, 2024 12:50
Copy link

sonarcloud bot commented Jun 26, 2024

@pyphilia pyphilia added this pull request to the merge queue Jun 26, 2024
Merged via the queue into main with commit 153f503 Jun 26, 2024
4 checks passed
@spaenleh spaenleh deleted the remove-uppy branch July 15, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants