MCPcopy Index your code
hub / github.com/TanStack/query / useQueryClient

Function useQueryClient

packages/vue-query/src/useQueryClient.ts:6–24  ·  view source on GitHub ↗
(id = '')

Source from the content-addressed store, hash-verified

4import type { QueryClient } from './queryClient'
5
6export function useQueryClient(id = ''): QueryClient {
7 // ensures that `inject()` can be used
8 if (!hasInjectionContext()) {
9 throw new Error(
10 'vue-query hooks can only be used inside setup() function or functions that support injection context.',
11 )
12 }
13
14 const key = getClientKey(id)
15 const queryClient = inject<QueryClient>(key)
16
17 if (!queryClient) {
18 throw new Error(
19 "No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.",
20 )
21 }
22
23 return queryClient
24}

Callers 9

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

Calls 1

getClientKeyFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…