Mark L
Mark L2mo ago

following the trpc 11 guide on app router fails with dynamicIO on nextJS

When using trpc with nextjs@15.0.3-canary.4 with dynamicIO enabled I get the following error when trying to create a query client. Error: Route "/" used Date.now() instead of using performance or without explicitly calling await connection() beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time at io (node_modules/next/src/server/node-environment-extensions/utils.tsx:33:31) at now (node_modules/next/src/server/node-environment-extensions/date.tsx:17:9) at createQueryClient (src/trpc/query-client.ts:5:2) at createQueryClient (src/trpc/react.tsx:17:28) at getQueryClient (src/trpc/react.tsx:41:22) 3 | 4 | export const createQueryClient = () =>
5 | new QueryClient({
| ^ 6 | defaultOptions: { 7 | queries: { Is there any way to solve this on my side? Or is this something that needs to be fixed inside of react-query or trpc?
3 Replies
NubeBuster
NubeBuster2mo ago
I have the same question. I dont see any solutions online
Raymond
Raymond3w ago
Found solution, in your provider you need to return children until window is rendered.
if (typeof window === 'undefined') {
return <>{children}</>
}
if (typeof window === 'undefined') {
return <>{children}</>
}
Raymond
Raymond3w ago
e.g.
No description

Did you find this page helpful?