fix(plex): round-2 deep-review follow-ups on the review fixes
Second review round, scoped to the round-1 fix commit (where round-1's own fixes
introduced new code):
- The collection chip-remove pruned collectionTitles to an empty {} on last removal,
which still hashes differently from the pristine no-collection state (key absent) in
the React Query keys → a residual cache split. Collapse an empty map to undefined so
the key-shape matches the pristine one.
- Replace the tautological "order-independent signature" test (both objects spread from
EMPTY_PLEX_FILTERS inherited the same key order, so it proved nothing) with full
literals in genuinely different insertion order that would fail an order-sensitive
JSON.stringify signature.
- Cover the collectionTitles chip-remove prune (usePlexActiveFilters.dom.test.tsx) and
the plexSurprise/plexDiscover lang-key split (queryKeys.test.ts) with regression tests.
Gate: tsc/lint/knip/prettier clean, 412 vitest.
This commit is contained in:
@@ -84,4 +84,16 @@ describe("qk — variadic composite plex keys", () => {
|
||||
{ genres: [] },
|
||||
]);
|
||||
});
|
||||
|
||||
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),
|
||||
);
|
||||
// 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