fix(collection): stop double-toast on add-to-playlist (mobile + web)#14423
Merged
Conversation
…re their own The addTrackToPlaylist saga ends with `if (!action.silent) put(toast(...))`, the silent gate added in #14393. Four callers ignored it: they dispatched addTrackToPlaylist without silent AND fired their own UI toast (some with richer content — e.g. the duplicate-add-confirmation modal's "View" link). Result: two toasts in a row for the same add. Both web's ToastContext.toast and mobile's useToast().toast funnel through the same Redux toast slice as the saga's toast action, so there's no implicit dedup — the duplicate was just timed close enough on desktop that users didn't always notice. Mobile users did. Pass { silent: true } in all four sites so the callers' richer toasts win and the saga's default toast is suppressed. Other callers (track menu, sidebar drag-drop, suggested-tracks "Add") don't fire their own toast and still get the saga's default — unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14423.audius.workers.dev Unique preview for this PR (deployed from this branch). |
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.
Summary
Adding a track via the Add-to-Collection drawer (mobile) or modal (web), or via the Duplicate-Add confirmation drawer/modal, showed two toasts in a row.
Root cause: the
addTrackToPlaylistsaga ends withif (!action.silent) put(toast(...))— thesilentgate added in #14393 lets callers suppress the saga's default toast when they want to show their own. Four callers ignored the gate: they dispatchedaddTrackToPlaylistwithoutsilentand fired their own UI toast (some richer than the saga's, e.g. the duplicate-add-confirmation modal's toast with a "View" link). Both the UI toasts and the saga's toast funnel through the same Redux toast slice —ToastContext.toastanduseToast().toastboth ultimately dispatch the sametoastaction — so there is no implicit dedup. Mobile users saw two toasts; desktop users got the same bug but the two were timed close enough that they often didn't notice.The fix is a one-line
{ silent: true }in each of the four call sites so the saga keeps quiet and the caller's richer toast wins. Other callers (track menu, sidebar drag-drop, suggested-tracks "Add") don't fire their own toast and keep getting the saga's default — unchanged.Files
packages/mobile/src/components/add-to-collection-drawer/AddToCollectionDrawer.tsxpackages/mobile/src/components/duplicate-add-confirmation-drawer/DuplicateAddConfirmationDrawer.tsxpackages/web/src/components/add-to-collection/desktop/AddToCollectionModal.tsxpackages/web/src/components/duplicate-add-confirmation-modal/DuplicateAddConfirmationModal.tsxTest plan
silent: true).🤖 Generated with Claude Code