Skip to content

Next.js cacheComponents (dynamicIO) dehydration error #9457

Description

@pluscubed

Describe the bug

In Next.js 15 with cacheComponents (formerly dynamicIO) turned on, dehydration causes an error:

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 Home (app/page.tsx:15:42)
    at Home (<anonymous>)
  13 |     <main>
  14 |       <h1>Pokemon Info</h1>
> 15 |       <HydrationBoundary state={dehydrate(queryClient)}>
     |                                          ^
  16 |         <PokemonInfo />
  17 |       </HydrationBoundary>
  18 |     </main>

I think it's this Date.now() usage here:

dehydratedAt: Date.now(),

I believe this issue is similar to #8277.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/blazing-moon-kyqpg5

Steps to reproduce

I took the example at https://tanstack.com/query/latest/docs/framework/react/examples/nextjs-app-prefetching, changed to Next.js canary and enabled cacheComponents

Expected behavior

No error

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

All platforms

Tanstack Query adapter

react-query

TanStack Query version

5.83.0

TypeScript version

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions