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

Function getQueryClientContext

packages/svelte-query/src/context.ts:14–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 * @returns The `QueryClient` set on context, whether by `QueryClientProvider` or {@link setQueryClientContext}.
13 */
14export const getQueryClientContext = (): QueryClient => {
15 const client = getContext<QueryClient | undefined>(_contextKey)
16 if (!client) {
17 throw new Error(
18 'No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?',
19 )
20 }
21
22 return client
23}
24
25/**
26 * Sets a `QueryClient` on Svelte's context, so it can be read with {@link getQueryClientContext} (or

Callers 1

useQueryClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected