MCPcopy Index your code
hub / github.com/code-with-antonio/nodebase / getQueryClient

Function getQueryClient

src/trpc/client.tsx:13–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11export const { TRPCProvider, useTRPC } = createTRPCContext<AppRouter>();
12let browserQueryClient: QueryClient;
13function getQueryClient() {
14 if (typeof window === 'undefined') {
15 // Server: always make a new query client
16 return makeQueryClient();
17 }
18 // Browser: make a new query client if we don't already have one
19 // This is very important, so we don't re-make a new client if React
20 // suspends during the initial render. This may not be needed if we
21 // have a suspense boundary BELOW the creation of the query client
22 if (!browserQueryClient) browserQueryClient = makeQueryClient();
23 return browserQueryClient;
24}
25function getUrl() {
26 const base = (() => {
27 if (typeof window !== 'undefined') return '';

Callers 3

TRPCReactProviderFunction · 0.85
prefetchFunction · 0.85
HydrateClientFunction · 0.85

Calls 1

makeQueryClientFunction · 0.90

Tested by

no test coverage detected