Skip to content

fix(query-core): use performance instead of Date.now to initialize mutationId#8315

Closed
ali-idrizi wants to merge 4 commits into
TanStack:mainfrom
ali-idrizi:fix/nextjs-date-now
Closed

fix(query-core): use performance instead of Date.now to initialize mutationId#8315
ali-idrizi wants to merge 4 commits into
TanStack:mainfrom
ali-idrizi:fix/nextjs-date-now

Conversation

@ali-idrizi

Copy link
Copy Markdown

Previously the MutationCache.#mutationId was initialized with Date.now(). When using dynamicIo with Next it was throwing:

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

The error is fixed by using performance.timeOrigin + performance.now() instead.

I have updated the next and react dependencies on the Next 15 integration and example from RC to stable. However, the dynamicIo is still an experimental feature and requires the canary dependency, so this not tested. I can confirm that the error was thrown locally by react-next-15 integration when enabling dynamicIo, and this change fixes it.

Closes #8277

@nx-cloud

nx-cloud Bot commented Nov 20, 2024

Copy link
Copy Markdown

☁️ Nx Cloud Report

CI is running/has finished running commands for commit efbf935. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Comment thread integrations/react-next-15/package.json Outdated
Comment on lines +13 to +14
"react": "19.0.0-rc-7ac8e612-20241113",
"react-dom": "19.0.0-rc-7ac8e612-20241113",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please use 19.0.0-rc.1, and use it everywhere. I’d really like to have the versions streamlined, thanks 🙏

Comment thread packages/query-core/src/mutationCache.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2024

Copy link
Copy Markdown

Open in Stackblitz

More templates

@tanstack/angular-query-devtools-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8315

@tanstack/angular-query-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@8315

@tanstack/query-async-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@8315

@tanstack/eslint-plugin-query

pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@8315

@tanstack/query-broadcast-client-experimental

pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8315

@tanstack/query-core

pnpm add https://pkg.pr.new/@tanstack/query-core@8315

@tanstack/query-devtools

pnpm add https://pkg.pr.new/@tanstack/query-devtools@8315

@tanstack/query-persist-client-core

pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@8315

@tanstack/query-sync-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@8315

@tanstack/react-query

pnpm add https://pkg.pr.new/@tanstack/react-query@8315

@tanstack/react-query-devtools

pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@8315

@tanstack/react-query-next-experimental

pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@8315

@tanstack/react-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@8315

@tanstack/solid-query

pnpm add https://pkg.pr.new/@tanstack/solid-query@8315

@tanstack/solid-query-devtools

pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@8315

@tanstack/solid-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@8315

@tanstack/svelte-query

pnpm add https://pkg.pr.new/@tanstack/svelte-query@8315

@tanstack/svelte-query-devtools

pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@8315

@tanstack/svelte-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@8315

@tanstack/vue-query

pnpm add https://pkg.pr.new/@tanstack/vue-query@8315

@tanstack/vue-query-devtools

pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@8315

commit: efbf935

@samyung0

Copy link
Copy Markdown

Any update on this?

@TkDodo

TkDodo commented Dec 23, 2024

Copy link
Copy Markdown
Collaborator

we have a second PR open that solves the issue in a different way, so we have to decide which one is going to make it.

@TkDodo

TkDodo commented Jan 3, 2025

Copy link
Copy Markdown
Collaborator

we’ll handle this with #8451 without the performance API, as this might also be excluded from prerenders in the future. see:

#8450 (comment)

@TkDodo TkDodo closed this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Next js 15 with dynamicIO: true returned server error

3 participants