From 6fedea502519502ffd691844d2f47fe4b491d39e Mon Sep 17 00:00:00 2001 From: Dylan Audius Date: Fri, 29 May 2026 12:29:39 -0700 Subject: [PATCH] fix(collection): silence saga toast when add-to-collection callers fire their own MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../add-to-collection-drawer/AddToCollectionDrawer.tsx | 6 +++++- .../DuplicateAddConfirmationDrawer.tsx | 2 +- .../add-to-collection/desktop/AddToCollectionModal.tsx | 4 +++- .../DuplicateAddConfirmationModal.tsx | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/mobile/src/components/add-to-collection-drawer/AddToCollectionDrawer.tsx b/packages/mobile/src/components/add-to-collection-drawer/AddToCollectionDrawer.tsx index cfe32065d89..22de608c9e8 100644 --- a/packages/mobile/src/components/add-to-collection-drawer/AddToCollectionDrawer.tsx +++ b/packages/mobile/src/components/add-to-collection-drawer/AddToCollectionDrawer.tsx @@ -134,7 +134,11 @@ export const AddToCollectionDrawer = () => { ) } else { toast({ content: messages.addedToast }) - dispatch(addTrackToPlaylist(trackId, item.playlist_id)) + dispatch( + addTrackToPlaylist(trackId, item.playlist_id, { + silent: true + }) + ) } onClose() }} diff --git a/packages/mobile/src/components/duplicate-add-confirmation-drawer/DuplicateAddConfirmationDrawer.tsx b/packages/mobile/src/components/duplicate-add-confirmation-drawer/DuplicateAddConfirmationDrawer.tsx index 7a08058b676..00eeec97345 100644 --- a/packages/mobile/src/components/duplicate-add-confirmation-drawer/DuplicateAddConfirmationDrawer.tsx +++ b/packages/mobile/src/components/duplicate-add-confirmation-drawer/DuplicateAddConfirmationDrawer.tsx @@ -71,7 +71,7 @@ export const DuplicateAddConfirmationDrawer = () => { const handleAdd = useCallback(() => { if (playlistId && trackId) { toast({ content: messages.addedToast }) - dispatch(addTrackToPlaylist(trackId, playlistId)) + dispatch(addTrackToPlaylist(trackId, playlistId, { silent: true })) } onClose() }, [playlistId, trackId, onClose, toast, messages.addedToast, dispatch]) diff --git a/packages/web/src/components/add-to-collection/desktop/AddToCollectionModal.tsx b/packages/web/src/components/add-to-collection/desktop/AddToCollectionModal.tsx index 71cab821f88..4de6c789200 100644 --- a/packages/web/src/components/add-to-collection/desktop/AddToCollectionModal.tsx +++ b/packages/web/src/components/add-to-collection/desktop/AddToCollectionModal.tsx @@ -121,7 +121,9 @@ const AddToCollectionModal = NiceModal.create(() => { }) ) } else { - dispatch(addTrackToPlaylist(trackId, playlist.playlist_id)) + dispatch( + addTrackToPlaylist(trackId, playlist.playlist_id, { silent: true }) + ) if (trackTitle) { toast({ content: messages.addedToast, diff --git a/packages/web/src/components/duplicate-add-confirmation-modal/DuplicateAddConfirmationModal.tsx b/packages/web/src/components/duplicate-add-confirmation-modal/DuplicateAddConfirmationModal.tsx index 52a7b63489c..2b94b83878c 100644 --- a/packages/web/src/components/duplicate-add-confirmation-modal/DuplicateAddConfirmationModal.tsx +++ b/packages/web/src/components/duplicate-add-confirmation-modal/DuplicateAddConfirmationModal.tsx @@ -61,7 +61,7 @@ export const DuplicateAddConfirmationModal = NiceModal.create(() => { const handleAdd = useCallback(() => { if (trackId && playlistId) { - dispatch(addTrackToPlaylist(trackId, playlistId)) + dispatch(addTrackToPlaylist(trackId, playlistId, { silent: true })) if (accountHandle) { toast(