feat(library): add strategy parameter for item fetching and update filter preview

This commit is contained in:
2026-03-12 03:24:32 +01:00
parent 6d1bed2ecb
commit e5a9b99b14
7 changed files with 46 additions and 13 deletions

View File

@@ -51,11 +51,12 @@ export function useGenres(contentType?: string) {
export function useLibraryItems(
filter: Pick<MediaFilter, "content_type" | "series_names" | "collections" | "search_term" | "genres"> | null,
enabled: boolean,
strategy?: string,
) {
const { token } = useAuthContext();
return useQuery({
queryKey: ["library", "items", filter],
queryFn: () => api.library.items(token!, filter!, 30),
queryKey: ["library", "items", filter, strategy ?? null],
queryFn: () => api.library.items(token!, filter!, 30, strategy),
enabled: !!token && enabled && !!filter,
staleTime: 2 * 60 * 1000,
});