-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: trpc/react-query — only one query client should exist #18179
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (12/13/24)1 reviewer was added to this PR based on Keith Williams's automation. |
const [queryClient] = useState( | ||
() => | ||
new QueryClient({ | ||
defaultOptions: { queries: { staleTime: 5000 } }, | ||
// these configurations are copied from "packages/trpc/react/trpc.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the comment says
@@ -1,11 +1,16 @@ | |||
import { type DehydratedState, QueryClient, QueryClientProvider } from "@tanstack/react-query"; | |||
import { HydrateClient } from "app/_trpc/HydrateClient"; | |||
"use client"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a client component. we use useState.
@@ -112,7 +113,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo | |||
}} | |||
/> | |||
)} | |||
{children} | |||
<TrpcProvider>{children}</TrpcProvider> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to call this provider only once and hence it needs to be in this file
E2E results are ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 nice find!
What does this PR do?
Mandatory Tasks (DO NOT REMOVE)