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

Function getQueryClientContext

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

Source from the content-addressed store, hash-verified

11 * @throws {Error} If no `QueryClient` was found in context.
12 */
13export const getQueryClientContext = (): QueryClient => {
14 const client = getContext<QueryClient | undefined>(_contextKey)
15 if (!client) {
16 throw new Error(
17 'No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?',
18 )
19 }
20
21 return client
22}
23
24/**
25 * 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