fix(plex): address code-review findings (F1-F3, F5, F9)
- F1: refresh grid after playback/collection-edit — invalidate the renamed ["plex-library"] query key in PlexPlayer + PlexCollectionEditor (was stale ["plex-browse"], a dead no-op) - F2: exclude hidden movies from facet counts/bounds — the movie facet base now always joins watch-state and mirrors unified_library's status branches, so facets match the visible grid exactly - F3: show_detail/item_detail live-Plex enrichment degrades instead of 500ing — broaden the best-effort block to except Exception - F5: don't re-run the heavy facet computation on sort-direction toggles — key the facets query only on fields plexFacets actually sends - F9: optimistic watched-toggle also updates the search Episodes section and gives toggleEpisodeWatched an optimistic path (shared optimisticStatus helper)
This commit is contained in:
parent
186fdbb0e5
commit
9f8e410033
5 changed files with 37 additions and 21 deletions
|
|
@ -64,8 +64,12 @@ export default function PlexSidebar({
|
|||
}
|
||||
// Facet values (genres/ratings/bounds) for the current scope, ADAPTED to the active filters
|
||||
// (faceted search) — so picking one filter narrows what the others offer. Refetches on any change.
|
||||
// Key only on the fields plexFacets actually sends — sortDir/collectionTitle don't reach /facets,
|
||||
// so keying on the whole `filters` object would re-run the heavy facet computation on every
|
||||
// sort-direction toggle (or chip-title change) for an identical request.
|
||||
const { sortDir: _sd, collectionTitle: _ct, ...facetKey } = filters;
|
||||
const facetsQ = useQuery({
|
||||
queryKey: ["plex-facets", scope, show, filters],
|
||||
queryKey: ["plex-facets", scope, show, facetKey],
|
||||
queryFn: () => api.plexFacets(scope, filters, show),
|
||||
enabled: !!scope,
|
||||
placeholderData: (prev) => prev, // keep the old chips visible during the refetch (no flicker)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue