fix(media): reset the uploader with cancelAll instead of clear on error - #2064
Open
giladresisi wants to merge 1 commit into
Open
giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
clear() throws while an upload is in progress with the Transloadit plugin, so every upload error raised a second exception (58 events/30d in prod). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g3KqiuR5TT68XdqpTRbZh
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix (frontend, media uploader). In the Uppy
errorhandler inapps/frontend/src/components/media/new.uploader.tsx,uppy.clear()is replaced withuppy.cancelAll(). Uppy'sclearthrows whenever an upload is in progress and the installed uploader plugin does not support per-file cancellation, which is the case with@uppy/transloadit;cancelAllremoves every file, so each in-flight upload is dropped as a whole instead of shrunk and Uppy does not throw. The rest of the handler (unlock,onEnd, order counter reset) is unchanged.Why was this change needed?
Sentry CLOUD-S1,
Error: The installed uploader plugin does not allow removing files during an upload, has 58 events from 32 users in the last 30 days: 39 on/launches(the post editor's uploader), 18 on/media, 1 on an X connect page.The handler is meant to reset the uploader after an upload error, but the very condition it runs under (an upload in progress) is the one in which
clearthrows. So every Transloadit failure during an upload, for example a failed assembly creation, produced a second exception from our own code on top of the original error, and the uploader was left in its half-finished state.Other information:
Same file as #2063 (the missing-results guard), independent lines; either can merge first.
QA
/media, and from the browser console make assembly creation fail, e.g. wrapwindow.fetchto reject any URL containingtransloadit.comError: The installed uploader plugin does not allow removing files during an uploadthrown fromnew.uploader.tsxwindow.fetchand, without reloading, upload another image: it uploads and appears in the library, showing the uploader recoveredTested locally exactly as above: step 3 reproduced on the unmodified code earlier in the same session, steps 4 and 5 verified with the change (no exception, the follow-up upload saved and listed).
Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_017g3KqiuR5TT68XdqpTRbZh