@tanstack/react-query
Version:
Hooks for managing, caching and syncing asynchronous and remote data in React
1 lines • 1.14 kB
Source Map (JSON)
{"version":3,"file":"usePrefetchInfiniteQuery.cjs","names":["useQueryClient","noop"],"sources":["../../src/usePrefetchInfiniteQuery.tsx"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\n\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\nimport type { UsePrefetchInfiniteQueryOptions } from './types'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UsePrefetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): void {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n void client.infiniteQuery(options).catch(noop)\n }\n}\n"],"mappings":";;;;AAWA,SAAgB,yBAOd,SAOA,aACM;CACN,MAAM,SAASA,4BAAAA,eAAe,WAAW;CAEzC,IAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GACxC,OAAY,cAAc,OAAO,CAAC,CAAC,MAAMC,qBAAAA,IAAI;AAEjD"}