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

Function unregisterDefaultQueryClient

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

Source from the content-addressed store, hash-verified

41 * @param client - The query client registration to release.
42 */
43export function unregisterDefaultQueryClient(client: QueryClient): void {
44 const count = registeredClients.get(client)
45 if (count === undefined) {
46 return
47 }
48
49 if (count > 1) {
50 registeredClients.set(client, count - 1)
51 return
52 }
53
54 registeredClients.delete(client)
55 if (defaultClient !== client) {
56 return
57 }
58
59 const remaining = [...registeredClients.keys()]
60 defaultClient = remaining.at(-1)
61}
62
63/**
64 * 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