Skip to content

fix: stop bulkStar from reporting false success on partial/total failure - #6101

Merged
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/bulkstar-false-success-toast
Sep 3, 2026
Merged

fix: stop bulkStar from reporting false success on partial/total failure#6101
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/bulkstar-false-success-toast

Conversation

@Bryandero98

Copy link
Copy Markdown
Contributor

Summary

  • Fixes MediaCollectionDetail: bulkStar fires uncoordinated per-item error toasts and reports false overall success on failure #6018
  • bulkStar in client/src/pages/MediaCollectionDetail.jsx looped over updateAnnotation calls, ignored the result entirely, and unconditionally fired a success toast — while useMediaAnnotations.js's updateAnnotation already 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.
  • updateAnnotation now accepts a { silent } option (suppresses the per-item error toast for batch callers) and returns { ok, entry } instead of a bare entry. This was necessary beyond what the issue described: entry alone can't signal success vs. failure, because the server legitimately returns entry: null on a real success too (unstarring an item with no note clears its annotation entirely, per server/routes/mediaAnnotations.js's own doc comment) — so the old res?.entry ?? null return was ambiguous between "cleared successfully" and "failed."
  • bulkStar now 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

  • Added 3 tests in MediaCollectionDetail.test.jsx covering all-success, all-failure, and partial-failure toast behavior (made updateAnnotation a controllable mock for this).
  • cd client && npx vitest run src/pages/MediaCollectionDetail.test.jsx src/hooks/useMediaAnnotations.test.jsx → 15/15 passed.
  • Also ran the other 4 test files that exercise useMediaAnnotations (ImageGen.*.test.jsx) to check for regressions from the return-shape change → 17/17 passed.

🤖 Generated with Claude Code

…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>
@atomantic
atomantic merged commit 71f27c2 into atomantic:main Sep 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MediaCollectionDetail: bulkStar fires uncoordinated per-item error toasts and reports false overall success on failure

2 participants