UNPKG

@suspensive/react-query-4

Version:

Suspensive interfaces for @tanstack/react-query@4

17 lines (14 loc) 749 B
'use client'; import { useQueryClient } from "@tanstack/react-query"; //#region src/usePrefetchInfiniteQuery.ts /** * The `usePrefetchInfiniteQuery` does not return anything, it should be used just to fire a prefetch during render, before a suspense boundary that wraps a component that uses `useSuspenseInfiniteQuery`. * @see {@link https://suspensive.org/docs/react-query/usePrefetchInfiniteQuery Suspensive Docs} */ function usePrefetchInfiniteQuery(options) { const queryClient = useQueryClient(); if (typeof options.queryKey !== "undefined" && !queryClient.getQueryState(options.queryKey)) queryClient.prefetchInfiniteQuery(options); } //#endregion export { usePrefetchInfiniteQuery }; //# sourceMappingURL=usePrefetchInfiniteQuery.mjs.map