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

Function unregisterDefaultQueryClient

packages/lit-query/src/context.ts:45–63  ·  view source on GitHub ↗
(client: QueryClient)

Source from the content-addressed store, hash-verified

43 * @param client - The query client registration to release.
44 */
45export function unregisterDefaultQueryClient(client: QueryClient): void {
46 const count = registeredClients.get(client)
47 if (count === undefined) {
48 return
49 }
50
51 if (count > 1) {
52 registeredClients.set(client, count - 1)
53 return
54 }
55
56 registeredClients.delete(client)
57 if (defaultClient !== client) {
58 return
59 }
60
61 const remaining = [...registeredClients.keys()]
62 defaultClient = remaining.at(-1)
63}
64
65/**
66 * Returns the registered default `QueryClient`, if exactly one default client is

Callers 1

unmountClientMethod · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected