TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
42.72k stars 2.93k forks source link

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

Open ali-idrizi opened 1 week ago

ali-idrizi commented 1 week ago

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 https://github.com/TanStack/query/issues/8277

nx-cloud[bot] commented 1 week ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit efbf935e35511d1affda1f23e8b1b238ba60117c. 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 - [`nx run-many --target=build --exclude=examples/** --exclude=integrations/**`](https://cloud.nx.app/runs/ekO1LYxRzi?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

pkg-pr-new[bot] commented 1 week ago

Open in Stackblitz

More templates

- [@tanstack/query-example-angular-basic](https://pkg.pr.new/template/43b387c8-7414-4f36-839c-390b6764412a) - [@tanstack/query-example-angular-devtools-panel](https://pkg.pr.new/template/d56295ac-dd9f-4a54-b5d2-014d9fbfe979) - [@tanstack/query-example-angular-infinite-query-with-max-pages](https://pkg.pr.new/template/1a9d9491-cfe2-47a6-a3db-345f12ee0f8e) - [@tanstack/query-example-angular-pagination](https://pkg.pr.new/template/b0dfd343-47b1-467a-afed-fff6c54f5889) - [@tanstack/query-example-angular-query-options-from-a-service](https://pkg.pr.new/template/013abe51-670d-4301-a4d2-470fccb9a97b) - [@tanstack/query-example-angular-router](https://pkg.pr.new/template/c0ff75b5-c2e3-4d0a-9186-f37b5a695120) - [@tanstack/query-example-angular-rxjs](https://pkg.pr.new/template/06693f1f-13f1-4b2e-8eaf-dc0c09e4d2c8) - [@tanstack/query-example-angular-simple](https://pkg.pr.new/template/59d30404-2805-4b81-b504-471936e53168) - [@tanstack/query-example-solid-astro](https://pkg.pr.new/template/c88e33b7-787f-434c-a1f1-b054c5d65b65) - [@tanstack/query-example-solid-basic](https://pkg.pr.new/template/a5cc214f-0e64-4aa6-b230-c65cde1d3748) - [@tanstack/query-example-solid-basic-graphql-request](https://pkg.pr.new/template/a43ff665-7aba-478d-9f8c-10fda4c58f8e) - [@tanstack/query-example-solid-default-query-function](https://pkg.pr.new/template/de0be496-0456-4317-81ff-2f80f8ad5e93) - [@tanstack/query-example-solid-simple](https://pkg.pr.new/template/959baa21-965e-4523-9f55-9733f52ea3e2) - [@tanstack/query-example-solid-start-streaming](https://pkg.pr.new/template/44d9dba4-06ce-4324-82cf-cacfcb813b51) - [@tanstack/query-example-react-algolia](https://pkg.pr.new/template/c0bc9328-bcf9-47c6-9d5a-ad355f89172a) - [@tanstack/query-example-react-basic](https://pkg.pr.new/template/76803d72-e40f-4729-9aef-52cda6c2cebd) - [@tanstack/query-example-react-auto-refetching](https://pkg.pr.new/template/6e2929b8-2593-484a-98f2-48ff4edaca4a) - [@tanstack/query-example-react-basic-graphql-request](https://pkg.pr.new/template/e47214a7-6203-4e94-865e-dc87da29075d) - [@tanstack/query-example-react-default-query-function](https://pkg.pr.new/template/5b6d97a7-9489-4da1-8ddf-1395803e65d6) - [@tanstack/query-example-react-devtools-panel](https://pkg.pr.new/template/51bf2e9e-5ced-4f83-a945-6379bf4e7b93) - [@tanstack/query-example-react-infinite-query-with-max-pages](https://pkg.pr.new/template/7d2300c3-4a5c-4a96-9daf-ccd59d7ba54e) - [@tanstack/query-example-react-load-more-infinite-scroll](https://pkg.pr.new/template/caf8acbe-1068-4988-be5e-ad5385cc2d3d) - [@tanstack/query-example-react-nextjs](https://pkg.pr.new/template/7c98f996-9a93-41e0-974c-3146ffce8b11) - [@tanstack/query-example-react-nextjs-app-prefetching](https://pkg.pr.new/template/a9b4b7e8-c3d6-4898-8a74-9e16ecf54eca) - [@tanstack/query-example-nextjs-suspense-streaming](https://pkg.pr.new/template/072a376d-38f8-4dba-92e9-ef31220e0dde) - [@tanstack/query-example-react-offline](https://pkg.pr.new/template/703f2bec-7624-47a2-a9c7-ae3ded52fcb5) - [@tanstack/query-example-react-optimistic-updates-cache](https://pkg.pr.new/template/2e274c92-79fb-49aa-9268-884717a752a3) - [@tanstack/query-example-react-optimistic-updates-ui](https://pkg.pr.new/template/2b5e2539-3eb2-45ca-bd6b-e864ada4cba3) - [@tanstack/query-example-react-pagination](https://pkg.pr.new/template/4e28e9e1-531b-429d-ba43-1e7fe4b7c3c2) - [@tanstack/query-example-react-playground](https://pkg.pr.new/template/3055bea8-05dd-45fb-8f53-9aca582b909c) - [@tanstack/query-example-react-prefetching](https://pkg.pr.new/template/c5f7f805-8cd1-4b3f-b1a1-57f5d94c3fa7) - [@tanstack/query-example-react-react-native](https://pkg.pr.new/template/3c77e3b9-82b7-48af-894b-c46c10d97e0e) - [@tanstack/query-example-react-router](https://pkg.pr.new/template/44509e2f-b9d2-48ca-9941-66aa966d60b5) - [@tanstack/query-example-react-rick-morty](https://pkg.pr.new/template/fa96f839-ac7f-4de2-9b1d-4f652df82a38) - [@tanstack/query-example-react-shadow-dom](https://pkg.pr.new/template/babc7cee-0277-45c5-b203-ef5af8718d8e) - [@tanstack/query-example-react-simple](https://pkg.pr.new/template/479c7fb5-ffdc-45a3-a672-cccc6bf0c79b) - [@tanstack/query-example-react-star-wars](https://pkg.pr.new/template/6b803855-2081-4d71-8893-999f457582d6) - [@tanstack/query-example-react-suspense](https://pkg.pr.new/template/b3386468-369e-4695-a42b-bca1c20502d6) - [@tanstack/query-example-vue-2.6-basic](https://pkg.pr.new/template/ef8a1184-4663-4c85-b5b5-56ce16723337) - [@tanstack/query-example-vue-basic](https://pkg.pr.new/template/3765b1c2-cb08-42e6-a09b-7f5c5689047b) - [@tanstack/query-example-vue-dependent-queries](https://pkg.pr.new/template/058c243f-5944-4c73-a977-d659be09a6c5) - [@tanstack/query-example-vue-2.7-basic](https://pkg.pr.new/template/413bd168-4d89-415a-9ad1-ce8cba379fda) - [@tanstack/query-example-vue-nuxt3](https://pkg.pr.new/template/71dcaa54-f37c-4eaf-87c8-e2d9349dbfa4) - [@tanstack/query-example-vue-persister](https://pkg.pr.new/template/40708a7e-d65d-4d96-92b4-29c7060911ea) - [@tanstack/query-example-vue-simple](https://pkg.pr.new/template/f172efa5-13cb-4f6c-859a-b1306089c558) - [@tanstack/query-example-svelte-auto-refetching](https://pkg.pr.new/template/17cdaaee-3c3c-4d53-90ac-f9ceb5c8a0a6) - [@tanstack/query-example-svelte-basic](https://pkg.pr.new/template/dcddf0f4-cf1c-4033-8730-c55c11d63dc5) - [@tanstack/query-example-svelte-load-more-infinite-scroll](https://pkg.pr.new/template/6e6cc2f6-d374-435b-82a1-d756a0319c06) - [@tanstack/query-example-svelte-optimistic-updates](https://pkg.pr.new/template/bc1b78ef-8453-464c-9cfb-07cf393f9c76) - [@tanstack/query-example-svelte-playground](https://pkg.pr.new/template/5d506265-33fc-435d-9bc0-3fb550da5d5f) - [@tanstack/query-example-svelte-simple](https://pkg.pr.new/template/69a97ba9-f264-4607-bff9-162fb2281fab) - [@tanstack/query-example-svelte-ssr](https://pkg.pr.new/template/74db42d7-7230-480a-a98a-d1f7dab8f09a) - [@tanstack/query-example-svelte-star-wars](https://pkg.pr.new/template/c4e16723-b887-43e6-85a7-faad1257b786)

@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