fix(plex): a reshuffle survives a refresh landing mid-deal; the ↻ spins for a deal only
The ↻ intent was spent as its fetch set out, so a watched toggle's resync cancelling that fetch re-ran it as a re-read of the old draw. It now lasts until the latest deal answers. The button spun on every re-read of the same titles; it now follows the deal. Comments that said the Surprise draw is never refetched are brought in line.
This commit is contained in:
@@ -7,10 +7,9 @@ import { notifyActionError } from "./actionErrors";
|
||||
// `resync` (invalidate) — which corrects the optimistic flip to truth either way. Shared by the
|
||||
// browse grid and the person page, each of which owns a different cache shape.
|
||||
//
|
||||
// `revert` is for state `resync` cannot correct, called on a failure only to put the card back: a
|
||||
// cache it must NOT refetch — a random draw (Discover's Surprise rail), which a refetch would
|
||||
// reshuffle under the viewer — or a component's local copy of the rows (a Plex playlist), which an
|
||||
// identical refetch never re-seeds (react-query keeps the same `data`).
|
||||
// `revert` is called on a failure only, to put the card back where `resync` does not, or not at once:
|
||||
// a component's local copy of the rows (a Plex playlist), which an identical refetch never re-seeds
|
||||
// (react-query keeps the same `data`), or a cache whose refetch lands later than the click's answer.
|
||||
export async function toggleWatchState(
|
||||
card: PlexCard,
|
||||
t: TFunction,
|
||||
|
||||
@@ -118,9 +118,8 @@ export const qk = {
|
||||
plex: () => ["plex"] as const,
|
||||
plexWatchLink: () => ["plex-watch-link"] as const,
|
||||
plexLibrary: (...rest: unknown[]) => ["plex-library", ...rest],
|
||||
// Discover surface: the rail payload keyed by scope+lang; `plexDiscover()` (no args) matches
|
||||
// both for a prefix invalidation after a watched-toggle. Surprise is its own key so the ↻ reshuffle
|
||||
// refetches it alone.
|
||||
// Discover surface: the rail payload keyed by scope+lang; `plexDiscover()` (no args) matches it and
|
||||
// the Surprise draw below for a prefix invalidation after a watched-toggle.
|
||||
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). UNDER the discover root,
|
||||
|
||||
Reference in New Issue
Block a user