fix(plex): a Surprise card whose watched toggle failed is put back

Deep-review round 3 of bug hunt 2026-09 — the sibling of the collection page's fix (d349bc90).
Discover's toggle flips the Surprise draw too, but its resync refetches only the rails (refetching the
draw would reshuffle it under the viewer), so a refused toggle stayed flipped there. toggleWatchState
takes an optional `revert`, called on a failure only; the queryKeys comment that claimed the watched
toggle invalidates the Surprise key now says what the code does.
This commit is contained in:
2026-09-11 18:05:30 +02:00
parent 76b5f7c93e
commit 785080f3da
4 changed files with 47 additions and 7 deletions
+3 -2
View File
@@ -117,8 +117,9 @@ export const qk = {
// refetches it alone.
plexDiscover: (...rest: unknown[]) => ["plex-discover", ...rest],
// Variadic like plexDiscover so it can key by scope + lang + the active filters (lang because a genre
// filter narrows against the language-specific genre column, like the grid); `plexSurprise()` (no args)
// stays a prefix for the reshuffle/watched-toggle invalidations.
// filter narrows against the language-specific genre column, like the grid). The ↻ reshuffle is the
// query's own refetch, and nothing invalidates this key — deliberately: a watched toggle flips the
// card in place (and reverts it on a failure) rather than reshuffle the rail under the viewer.
plexSurprise: (...rest: unknown[]) => ["plex-surprise", ...rest],
plexSuggest: (...rest: unknown[]) => ["plex-suggest", ...rest],
// Optional trailing `lang` (E5 S6): a language switch remounts the detail with a new key so HU/EN