Skip to content
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

Route "/" used Date.now() instead of using performance ... when using TanStack react query and dynamicIO #73785

Closed
spaceo opened this issue Dec 11, 2024 · 8 comments
Labels
bug Issue was opened via the bug report template. dynamicIO Related to dynamicIO. linear: next Confirmed issue that is tracked by the Next.js team. locked Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@spaceo
Copy link

spaceo commented Dec 11, 2024

Link to the code that reproduces this issue

https://github.com/TanStack/query

To Reproduce

  1. Create a query client provider
  2. In layout wrap the children in the provider
  3. Start the app in dev mode
  4. When loading the app the error will occur

Related to this issue:
#72024

Current vs. Expected behavior

I would expect no error to happen :)
But apparently the QueryClient uses a "forbidden" way to handle current time in its cache evaluation.

image

Provide environment information

/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.1.1-canary.0 // Latest available version is detected (15.1.1-canary.0).
  eslint-config-next: 15.0.3
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

@spaceo spaceo added the bug Issue was opened via the bug report template. label Dec 11, 2024
@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label Dec 11, 2024
@thatguyinabeanie
Copy link

I am also experiencing this bug as well

@TechFeatured
Copy link

I was able to remove this error by wrapping my Provider in a server component and calling await connection - then wrapping the call in Suspense.

async function QueryProviderOuter({ children }: { children: ReactNode }) {
  await connection();
  return <QueryProvider>{children}</QueryProvider>;
}
<Suspense fallback={<LoadingSpinner />}>
                        <QueryProviderOuter>
                          <main className="flex-1">{children}</main>
                        </QueryProviderOuter>
                      </Suspense>

unsure if this opts the entire subtree into client rendering though

@gnoff
Copy link
Contributor

gnoff commented Dec 14, 2024

@TechFeatured yeah this will essentially opt everything downstream of this layout into being dynamic only. With PPR you can maybe still have a very generic static shell but since this is presumaly quite high in the application hierarchy no deeper layouts with their own Suspense boundaries will end up being prerendered. I can see that this use of Date.now() is related to coped mutations. I don't know yet whether there is an upstream change in react-query that could make this feature compatible with prerendering with dynamicIO. I'll dig in a bit and see if I can make sense of it

@2blo

This comment has been minimized.

@gnoff
Copy link
Contributor

gnoff commented Dec 17, 2024

I've opened a PR in Tanstack-query that will address this issue if landed. Will revisit once there is movement there

@Esequiel378
Copy link

Hey! I saw your PR merged a couple of hours ago (excellent work by the way, @gnoff ). Do you have a rough idea of when this would be available? Or if there is a way to use this new change in the meantime 🤗

@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label Jan 6, 2025
@ztanner ztanner added the dynamicIO Related to dynamicIO. label Jan 6, 2025
@eps1lon
Copy link
Member

eps1lon commented Jan 8, 2025

@eps1lon eps1lon closed this as completed Jan 8, 2025
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. dynamicIO Related to dynamicIO. linear: next Confirmed issue that is tracked by the Next.js team. locked Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests

8 participants