feat(plex): adaptive (faceted) filters — each filter narrows the others
The sidebar's filter chips/bounds now ADAPT to the active filters: /facets takes the current filters and computes each group's available values with all the OTHER active filters applied but not its own (standard faceted search). So picking e.g. IMDb rating >=8 trims the genre/content-rating chips + year bounds to what's still reachable, and picking a genre narrows them further — while a multi-select group (genres) still shows options to add. Extracted _meta_filter_conds (shared by browse/unified/facets), and the frontend passes the live filters to plexFacets (query keyed on them, previous chips kept during refetch). Search text is intentionally not factored into facets.
This commit is contained in:
parent
736db017e4
commit
017be5f8ca
3 changed files with 119 additions and 49 deletions
|
|
@ -62,11 +62,13 @@ export default function PlexSidebar({
|
|||
qc.invalidateQueries({ queryKey: ["plex-playlists"] });
|
||||
onOpenPlaylist(pl.id);
|
||||
}
|
||||
// Facet values (genres/ratings/bounds) for the current cross-library scope (movie|show|both).
|
||||
// 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.
|
||||
const facetsQ = useQuery({
|
||||
queryKey: ["plex-facets", scope],
|
||||
queryFn: () => api.plexFacets(scope),
|
||||
queryKey: ["plex-facets", scope, filters],
|
||||
queryFn: () => api.plexFacets(scope, filters),
|
||||
enabled: !!scope,
|
||||
placeholderData: (prev) => prev, // keep the old chips visible during the refetch (no flicker)
|
||||
});
|
||||
const facets = facetsQ.data;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue