Download node_modules/@tanstack/react-query/src/usePrefetchQuery.tsx from metarm/QMetaRam: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/react-query/src/usePrefetchQuery.tsx
- Command line
-
hf download hf://metarm/QMetaRam/node_modules/@tanstack/react-query/src/usePrefetchQuery.tsx
-
curl -L -o usePrefetchQuery.tsx https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/react-query/src/usePrefetchQuery.tsx
713 Bytes
| import { noop } from '@tanstack/query-core' | |
| import { useQueryClient } from './QueryClientProvider' | |
| import type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core' | |
| import type { UsePrefetchQueryOptions } from './types' | |
| export function usePrefetchQuery< | |
| TQueryFnData = unknown, | |
| TError = DefaultError, | |
| TData = TQueryFnData, | |
| TQueryData = TQueryFnData, | |
| TQueryKey extends QueryKey = QueryKey, | |
| >( | |
| options: UsePrefetchQueryOptions< | |
| TQueryFnData, | |
| TError, | |
| TData, | |
| TQueryData, | |
| TQueryKey | |
| >, | |
| queryClient?: QueryClient, | |
| ): void { | |
| const client = useQueryClient(queryClient) | |
| if (!client.getQueryState(options.queryKey)) { | |
| void client.query(options).catch(noop) | |
| } | |
| } | |