MCPcopy Create free account
hub / github.com/TanStack/query / useQueryClientResolver

Function useQueryClientResolver

packages/solid-query/src/QueryClientProvider.tsx:47–64  ·  view source on GitHub ↗
(
  queryClient?: Accessor<QueryClient | undefined>,
)

Source from the content-addressed store, hash-verified

45 * @returns An accessor that returns the resolved client. It throws if neither client is available.
46 */
47export const useQueryClientResolver = (
48 queryClient?: Accessor<QueryClient | undefined>,
49): Accessor<QueryClient> => {
50 const contextClient = useContext(QueryClientContext)
51
52 return () => {
53 const resolvedClient = queryClient?.()
54 if (resolvedClient) {
55 return resolvedClient
56 }
57
58 if (!contextClient) {
59 throw new Error(queryClientContextError)
60 }
61
62 return contextClient()
63 }
64}
65
66/**
67 * The props accepted by `QueryClientProvider`.

Callers 7

useBaseQueryFunction · 0.90
useMutationFunction · 0.90
useMutationStateFunction · 0.90
useQueriesFunction · 0.90
useIsMutatingFunction · 0.90
useIsFetchingFunction · 0.90
PageFunction · 0.90

Calls

no outgoing calls

Tested by 1

PageFunction · 0.72