MCPcopy Create free account
hub / github.com/prisma/prisma-examples / getQueryClient

Function getQueryClient

orm/nextjs-trpc/src/components/providers.tsx:19–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18let browserQueryClient: QueryClient | undefined = undefined;
19function getQueryClient() {
20 if (typeof window === 'undefined') {
21 // Server: always make a new query client
22 return makeQueryClient();
23 } else {
24 // Browser: make a new query client if we don't already have one
25 // This is very important, so we don't re-make a new client if React
26 // suspends during the initial render. This may not be needed if we
27 // have a suspense boundary BELOW the creation of the query client
28 if (!browserQueryClient) browserQueryClient = makeQueryClient();
29 return browserQueryClient;
30 }
31}
32export default function App({ children }: { children: React.ReactNode }) {
33 const queryClient = getQueryClient();
34 const [trpcClient] = useState(() =>

Callers 1

AppFunction · 0.85

Calls 1

makeQueryClientFunction · 0.85

Tested by

no test coverage detected