1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Disable refetch on window refocus for search suggestions

This commit is contained in:
viown 2025-03-06 18:58:15 +03:00
parent 2776e660fa
commit 533ea7dbb9

View file

@ -7,14 +7,11 @@ import { useQuery } from '@tanstack/react-query';
import { useApi } from 'hooks/useApi';
const fetchGetItems = async (
api?: Api,
userId?: string,
api: Api,
userId: string,
parentId?: string,
options?: AxiosRequestConfig
) => {
if (!api) throw new Error('No API instance available');
if (!userId) throw new Error('No User ID provided');
const response = await getItemsApi(api).getItems(
{
userId: userId,
@ -43,7 +40,8 @@ export const useSearchSuggestions = (parentId?: string) => {
return useQuery({
queryKey: ['SearchSuggestions', { parentId }],
queryFn: ({ signal }) =>
fetchGetItems(api, userId, parentId, { signal }),
fetchGetItems(api!, userId!, parentId, { signal }),
refetchOnWindowFocus: false,
enabled: !!api && !!userId
});
};