fix(plex): round-3 deep-review follow-ups
Third review round, scoped to the round-2 fix commit. The production ternary was
confirmed correct; two sibling-surface findings:
- The sidebar CollectionPicker's clear-all still wrote collectionTitles:{} while the
chip-row remove (fixed in round 2) wrote undefined — a divergence that leaves the
{}-vs-absent cache split on the picker path. Collapse an empty map to undefined there
too, so both no-collection routes key-match the pristine state.
- The queryKeys lang test was near-tautological (a variadic-spread factory can't drop a
passed arg), and nothing asserted the CALL SITE keys carry lang. Add a real guard in
PlexDiscover.dom.test.tsx that inspects the registered query keys for scope+lang, and
reword the factory test's comment to say it only shape-pins the segment pass-through.
Gate: tsc/lint/knip/prettier clean, 413 vitest.
This commit is contained in:
@@ -85,14 +85,22 @@ describe("qk — variadic composite plex keys", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("keys the Discover/Surprise rails by lang so a language switch caches separately", () => {
|
||||
// Both surfaces filter against the language-specific genre column, so HU and EN must not collide.
|
||||
expect(qk.plexDiscover("movie", "hu", FILTERS)).not.toEqual(
|
||||
qk.plexDiscover("movie", "en", FILTERS),
|
||||
);
|
||||
expect(qk.plexSurprise("movie", "hu", FILTERS)).not.toEqual(
|
||||
qk.plexSurprise("movie", "en", FILTERS),
|
||||
);
|
||||
it("preserves scope+lang+filters as distinct Discover/Surprise key segments", () => {
|
||||
// Shape-pinning only: these lock that the variadic factory carries every arg through (a "tidy-up"
|
||||
// that drops a param would break cache separation). That the CALL SITE actually passes lang is
|
||||
// guarded separately in PlexDiscover.dom.test.tsx (it inspects the registered query keys).
|
||||
expect(qk.plexDiscover("movie", "hu", FILTERS)).toEqual([
|
||||
"plex-discover",
|
||||
"movie",
|
||||
"hu",
|
||||
FILTERS,
|
||||
]);
|
||||
expect(qk.plexSurprise("movie", "hu", FILTERS)).toEqual([
|
||||
"plex-surprise",
|
||||
"movie",
|
||||
"hu",
|
||||
FILTERS,
|
||||
]);
|
||||
// A bare call stays a prefix for the reshuffle/watched-toggle invalidations.
|
||||
expect(qk.plexSurprise()).toEqual(["plex-surprise"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user