fix: stop bulkStar from reporting false success on partial/total failure - #6101
Merged
atomantic merged 1 commit intoSep 3, 2026
Merged
Conversation
…ure (atomantic#6018) bulkStar in MediaCollectionDetail.jsx ignored updateAnnotation's result and always fired a success toast, while useMediaAnnotations.js already toasted an individual error for each failure — contradictory toasts, plus the success toast lied about items that were actually reverted. updateAnnotation now takes a { silent } option and returns { ok, entry } instead of a bare entry — entry alone can't signal success/failure because the server legitimately returns entry: null on a real success too (an unstar with no note clears the annotation entirely). bulkStar passes { silent: true }, counts successes/failures, and shows one consolidated toast for all-success, all-failure, and partial-failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
bulkStarinclient/src/pages/MediaCollectionDetail.jsxlooped overupdateAnnotationcalls, ignored the result entirely, and unconditionally fired a success toast — whileuseMediaAnnotations.js'supdateAnnotationalready toasted an individual error for every failure. For a batch with failures the user saw a burst of error toasts followed by a contradictory success toast, and the optimistic UI update for failed items had already been reverted despite the success message.updateAnnotationnow accepts a{ silent }option (suppresses the per-item error toast for batch callers) and returns{ ok, entry }instead of a bareentry. This was necessary beyond what the issue described:entryalone can't signal success vs. failure, because the server legitimately returnsentry: nullon a real success too (unstarring an item with no note clears its annotation entirely, perserver/routes/mediaAnnotations.js's own doc comment) — so the oldres?.entry ?? nullreturn was ambiguous between "cleared successfully" and "failed."bulkStarnow calls with{ silent: true }, counts successes/failures, and shows exactly one consolidated toast: success when all succeed, an error when all fail, and a combined "N succeeded; M failed" error on partial failure.Test plan
MediaCollectionDetail.test.jsxcovering all-success, all-failure, and partial-failure toast behavior (madeupdateAnnotationa controllable mock for this).cd client && npx vitest run src/pages/MediaCollectionDetail.test.jsx src/hooks/useMediaAnnotations.test.jsx→ 15/15 passed.useMediaAnnotations(ImageGen.*.test.jsx) to check for regressions from the return-shape change → 17/17 passed.🤖 Generated with Claude Code