Repository navigation
fix(web): keep the Audio menu on a saved pick when a later pick fails - #4541
Conversation
The audio preference hooks returned the item-detail refetch from onSuccess, so mutateAsync resolved only once those refetches finished. The pre-play Audio menu records a pick as saved when mutateAsync resolves, but the write queue sends the next pick as soon as the HTTP write settles. A quick second pick that failed during the first pick's refetch rolled the menu back to the choice before the first pick, although the server kept it. Start the refetches without waiting for them, as the subtitle hooks do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: N/A
Validation tasks: none
Other clients: Apple N/A (web-only: the defect is in the web app's save hooks); Android N/A (web-only, same reason); Roku N/A (web-only, same reason)
On a movie or episode page, the Audio menu can show Auto after the server has saved a track pick. Pick track A, then quickly pick track B. If B's save fails while the page is still reloading the item after A's save, the menu goes back to Auto. The server kept A, so the menu no longer shows what the next Play will use.
The menu counts a pick as saved when the save's
mutateAsyncresolves.useSetAudioPreferenceanduseDeleteAudioPreferencereturned the item-detail and catalog refetch fromonSuccess, somutateAsyncresolved only after those refetches finished. The write queue sends B as soon as A's request returns. When B failed first, the menu rolled back to the last pick it had recorded as saved, which was still Auto.Approach
Both audio hooks now start the refetches in
onSuccesswithout waiting for them, so a save counts as done when the server answers. #4538 makes the same change to the subtitle hooks. Nothing else used those mutations' pending state, and Play already waits on the write queue rather than on the mutation.This touches
trackPreferences.tsnext to #4534'snetworkModelines, so whichever merges second needs a small rebase.Validation
EpisodeContent.test.tsxholds it. It keeps the item page's detail query open with a refetch that never finishes, saves track 1, and fails the next pick. On main the menu ends on Auto; with this change it stays on track 1.src/player,src/hooks/queries, andsrc/pages/ItemDetailpass (1192 tests).Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/audio-pick-save-before-refetch/
Risks
None identified. The item page still refetches after a save; the save just doesn't wait for it.
Checklist
AI Disclosure
onSuccessbodies, with nothing added. A low-level code review (one pass over the diff) found nothing, and a simplify pass changed nothing. A background adversarial review with gpt-6.2-sol on c421b31 found one low-severity test issue: the test held a cache key the item page doesn't read. Fixed in d5febed; the test now holds the page's own detail query and still fails on main.🤖 Generated with Claude Code
Note
Fix Audio menu losing a saved pick when a later pick fails
QueryObserversetup where the first detail fetch succeeds and the refetch stays pending; therenderWithTrackshelper now accepts an optionalQueryClient.Macroscope summarized d5febed.