diff --git a/docs/framework/react/guides/advanced-ssr.md b/docs/framework/react/guides/advanced-ssr.md index 10ac86c69c..bbbac63208 100644 --- a/docs/framework/react/guides/advanced-ssr.md +++ b/docs/framework/react/guides/advanced-ssr.md @@ -365,7 +365,9 @@ With the prefetching patterns described above, React Query is perfectly compatib As of React Query v5.40.0, you don't have to `await` all prefetches for this to work, as `pending` Queries can also be dehydrated and sent to the client. This lets you kick off prefetches as early as possible without letting them block an entire Suspense boundary, and streams the _data_ to the client as the query finishes. This can be useful for example if you want to prefetch some content that is only visible after some user interaction, or say if you want to `await` and render the first page of an infinite query, but start prefetching page 2 without blocking rendering. -To make this work, we have to instruct the `queryClient` to also `dehydrate` pending Queries. We can do this globally, or by passing that option directly to `hydrate`: +To make this work, we have to instruct the `queryClient` to also `dehydrate` pending Queries. We can do this globally, or by passing that option directly to `hydrate`. + +We will also need to move the `getQueryClient()` function out of our `app/providers.jsx` file as we want to use it in our server component and our client provider. ```tsx // app/get-query-client.ts @@ -378,8 +380,7 @@ function makeQueryClient() { staleTime: 60 * 1000, }, dehydrate: { - // per default, only successful Queries are included, - // this includes pending Queries as well + // include pending queries in dehydration shouldDehydrateQuery: (query) => defaultShouldDehydrateQuery(query) || query.state.status === 'pending', @@ -387,6 +388,22 @@ function makeQueryClient() { }, }) } + +let browserQueryClient: QueryClient | undefined = undefined + +export function getQueryClient() { + if (isServer) { + // Server: always make a new query client + return makeQueryClient() + } else { + // Browser: make a new query client if we don't already have one + // This is very important, so we don't re-make a new client if React + // suspends during the initial render. This may not be needed if we + // have a suspense boundary BELOW the creation of the query client + if (!browserQueryClient) browserQueryClient = makeQueryClient() + return browserQueryClient + } +} ``` > Note: This works in NextJs and Server Components because React can serialize Promises over the wire when you pass them down to Client Components. @@ -439,7 +456,7 @@ If you're using non-JSON data types and serialize the query results on the serve import { QueryClient, defaultShouldDehydrateQuery } from '@tanstack/react-query' import { deserialize, serialize } from './transformer' -export function makeQueryClient() { +function makeQueryClient() { return new QueryClient({ defaultOptions: { // ... @@ -452,6 +469,8 @@ export function makeQueryClient() { }, }) } + +// ... ``` ```tsx @@ -461,11 +480,12 @@ import { HydrationBoundary, QueryClient, } from '@tanstack/react-query' +import { getQueryClient } from './get-query-client' import { serialize } from './transformer' import Posts from './posts' export default function PostsPage() { - const queryClient = new QueryClient() + const queryClient = getQueryClient() // look ma, no await queryClient.prefetchQuery({ diff --git a/examples/angular/basic/package.json b/examples/angular/basic/package.json index 2335988273..199cdfc637 100644 --- a/examples/angular/basic/package.json +++ b/examples/angular/basic/package.json @@ -14,7 +14,7 @@ "@angular/core": "^17.3.10", "@angular/platform-browser": "^17.3.10", "@angular/platform-browser-dynamic": "^17.3.10", - "@tanstack/angular-query-experimental": "^5.51.1", + "@tanstack/angular-query-experimental": "^5.51.4", "rxjs": "^7.8.1", "tslib": "^2.6.2", "zone.js": "^0.14.6" @@ -23,7 +23,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.10", - "@tanstack/angular-query-devtools-experimental": "^5.51.1", + "@tanstack/angular-query-devtools-experimental": "^5.51.4", "typescript": "5.3.3" } } diff --git a/examples/angular/infinite-query-with-max-pages/package.json b/examples/angular/infinite-query-with-max-pages/package.json index 4af2e2ddb2..1da442fd94 100644 --- a/examples/angular/infinite-query-with-max-pages/package.json +++ b/examples/angular/infinite-query-with-max-pages/package.json @@ -14,7 +14,7 @@ "@angular/core": "^17.3.10", "@angular/platform-browser": "^17.3.10", "@angular/platform-browser-dynamic": "^17.3.10", - "@tanstack/angular-query-experimental": "^5.51.1", + "@tanstack/angular-query-experimental": "^5.51.4", "rxjs": "^7.8.1", "tslib": "^2.6.2", "zone.js": "^0.14.6" @@ -23,7 +23,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.10", - "@tanstack/angular-query-devtools-experimental": "^5.51.1", + "@tanstack/angular-query-devtools-experimental": "^5.51.4", "typescript": "5.3.3" } } diff --git a/examples/angular/router/package.json b/examples/angular/router/package.json index b55033d53f..4e599dc635 100644 --- a/examples/angular/router/package.json +++ b/examples/angular/router/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "^17.3.10", "@angular/platform-browser-dynamic": "^17.3.10", "@angular/router": "^17.3.10", - "@tanstack/angular-query-experimental": "^5.51.1", + "@tanstack/angular-query-experimental": "^5.51.4", "rxjs": "^7.8.1", "tslib": "^2.6.2", "zone.js": "^0.14.6" @@ -24,7 +24,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.10", - "@tanstack/angular-query-devtools-experimental": "^5.51.1", + "@tanstack/angular-query-devtools-experimental": "^5.51.4", "typescript": "5.3.3" } } diff --git a/examples/angular/simple/package.json b/examples/angular/simple/package.json index 30fa619250..44cb75aed6 100644 --- a/examples/angular/simple/package.json +++ b/examples/angular/simple/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "^17.3.10", "@angular/platform-browser-dynamic": "^17.3.10", "@angular/router": "^17.3.10", - "@tanstack/angular-query-experimental": "^5.51.1", + "@tanstack/angular-query-experimental": "^5.51.4", "rxjs": "^7.8.1", "tslib": "^2.6.2", "zone.js": "^0.14.6" @@ -24,7 +24,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.10", - "@tanstack/angular-query-devtools-experimental": "^5.51.1", + "@tanstack/angular-query-devtools-experimental": "^5.51.4", "typescript": "5.3.3" } } diff --git a/examples/react/algolia/package.json b/examples/react/algolia/package.json index c59ef462d4..3ed09724f9 100644 --- a/examples/react/algolia/package.json +++ b/examples/react/algolia/package.json @@ -11,8 +11,8 @@ "dependencies": { "@algolia/client-search": "4.23.3", "@algolia/transporter": "4.23.3", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "algoliasearch": "4.23.3", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" diff --git a/examples/react/auto-refetching/package.json b/examples/react/auto-refetching/package.json index 16f1e6503b..cb56b082e3 100644 --- a/examples/react/auto-refetching/package.json +++ b/examples/react/auto-refetching/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/basic-graphql-request/package.json b/examples/react/basic-graphql-request/package.json index f3a3b60101..065567683a 100644 --- a/examples/react/basic-graphql-request/package.json +++ b/examples/react/basic-graphql-request/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "graphql": "^16.8.1", "graphql-request": "^7.0.1", "react": "19.0.0-rc-4c2e457c7c-20240522", diff --git a/examples/react/basic/package.json b/examples/react/basic/package.json index 62cf9f88b0..7e6bd61fd4 100644 --- a/examples/react/basic/package.json +++ b/examples/react/basic/package.json @@ -9,10 +9,10 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/query-sync-storage-persister": "^5.51.1", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", - "@tanstack/react-query-persist-client": "^5.51.1", + "@tanstack/query-sync-storage-persister": "^5.51.4", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", + "@tanstack/react-query-persist-client": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/default-query-function/package.json b/examples/react/default-query-function/package.json index 4d8153c285..97cb35b4f7 100644 --- a/examples/react/default-query-function/package.json +++ b/examples/react/default-query-function/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/infinite-query-with-max-pages/package.json b/examples/react/infinite-query-with-max-pages/package.json index 0abc7c8b15..8946a56dc9 100644 --- a/examples/react/infinite-query-with-max-pages/package.json +++ b/examples/react/infinite-query-with-max-pages/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/load-more-infinite-scroll/package.json b/examples/react/load-more-infinite-scroll/package.json index c26b648e12..04fd7cf6ee 100644 --- a/examples/react/load-more-infinite-scroll/package.json +++ b/examples/react/load-more-infinite-scroll/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/react/nextjs-app-prefetching/package.json b/examples/react/nextjs-app-prefetching/package.json index 897d8237ea..b9319338ad 100644 --- a/examples/react/nextjs-app-prefetching/package.json +++ b/examples/react/nextjs-app-prefetching/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^15.0.0-rc.0", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" diff --git a/examples/react/nextjs-suspense-streaming/package.json b/examples/react/nextjs-suspense-streaming/package.json index 4a1e1fffc2..c8c0b7abdc 100644 --- a/examples/react/nextjs-suspense-streaming/package.json +++ b/examples/react/nextjs-suspense-streaming/package.json @@ -9,9 +9,9 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", - "@tanstack/react-query-next-experimental": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", + "@tanstack/react-query-next-experimental": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/nextjs/package.json b/examples/react/nextjs/package.json index bcf471f148..0753b99187 100644 --- a/examples/react/nextjs/package.json +++ b/examples/react/nextjs/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/offline/package.json b/examples/react/offline/package.json index 0324c944ac..f5ac9ce1f6 100644 --- a/examples/react/offline/package.json +++ b/examples/react/offline/package.json @@ -8,11 +8,11 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/query-sync-storage-persister": "^5.51.1", + "@tanstack/query-sync-storage-persister": "^5.51.4", "@tanstack/react-location": "^3.7.4", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", - "@tanstack/react-query-persist-client": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", + "@tanstack/react-query-persist-client": "^5.51.4", "msw": "^2.3.0", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522", diff --git a/examples/react/optimistic-updates-cache/package.json b/examples/react/optimistic-updates-cache/package.json index 864a75b1a9..2998e933f6 100755 --- a/examples/react/optimistic-updates-cache/package.json +++ b/examples/react/optimistic-updates-cache/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/optimistic-updates-ui/package.json b/examples/react/optimistic-updates-ui/package.json index b9c4339614..4b14a6996a 100755 --- a/examples/react/optimistic-updates-ui/package.json +++ b/examples/react/optimistic-updates-ui/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/pagination/package.json b/examples/react/pagination/package.json index c83ea5808f..a5f5adb7be 100644 --- a/examples/react/pagination/package.json +++ b/examples/react/pagination/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/playground/package.json b/examples/react/playground/package.json index a74257aef0..0024afca4d 100644 --- a/examples/react/playground/package.json +++ b/examples/react/playground/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/prefetching/package.json b/examples/react/prefetching/package.json index 0be903f43a..2215b063cc 100644 --- a/examples/react/prefetching/package.json +++ b/examples/react/prefetching/package.json @@ -8,8 +8,8 @@ "start": "next start" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "next": "^14.2.4", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/react/react-native/package.json b/examples/react/react-native/package.json index 9d5f91d908..388bac5370 100644 --- a/examples/react/react-native/package.json +++ b/examples/react/react-native/package.json @@ -14,8 +14,8 @@ "@react-native-community/netinfo": "^11.3.1", "@react-navigation/native": "^6.1.6", "@react-navigation/stack": "^6.3.16", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "expo": "^51.0.8", "expo-constants": "^16.0.1", "expo-status-bar": "^1.12.1", diff --git a/examples/react/react-router/package.json b/examples/react/react-router/package.json index 57f392a2f5..964d0eafb2 100644 --- a/examples/react/react-router/package.json +++ b/examples/react/react-router/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "localforage": "^1.10.0", "match-sorter": "^6.3.4", "react": "19.0.0-rc-4c2e457c7c-20240522", diff --git a/examples/react/rick-morty/package.json b/examples/react/rick-morty/package.json index e6c3846eb3..a90399786f 100644 --- a/examples/react/rick-morty/package.json +++ b/examples/react/rick-morty/package.json @@ -12,8 +12,8 @@ "@emotion/styled": "^11.11.5", "@mui/material": "^5.15.18", "@mui/styles": "^5.15.18", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522", "react-router": "^6.23.1", diff --git a/examples/react/shadow-dom/package.json b/examples/react/shadow-dom/package.json index e014173a3b..58d5db45f4 100644 --- a/examples/react/shadow-dom/package.json +++ b/examples/react/shadow-dom/package.json @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/simple/package.json b/examples/react/simple/package.json index 0b8affa0fe..9c43f8a41b 100644 --- a/examples/react/simple/package.json +++ b/examples/react/simple/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/star-wars/package.json b/examples/react/star-wars/package.json index 9ee8adfe00..6c1bbfbe3f 100644 --- a/examples/react/star-wars/package.json +++ b/examples/react/star-wars/package.json @@ -12,8 +12,8 @@ "@emotion/styled": "^11.11.5", "@mui/material": "^5.15.18", "@mui/styles": "^5.15.18", - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522", "react-router": "^6.23.1", diff --git a/examples/react/suspense/package.json b/examples/react/suspense/package.json index 6831d68d11..04743561ab 100644 --- a/examples/react/suspense/package.json +++ b/examples/react/suspense/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/react-query": "^5.51.1", - "@tanstack/react-query-devtools": "^5.51.1", + "@tanstack/react-query": "^5.51.4", + "@tanstack/react-query-devtools": "^5.51.4", "font-awesome": "^4.7.0", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522", diff --git a/examples/solid/astro/package.json b/examples/solid/astro/package.json index 5867053873..e70c60633c 100644 --- a/examples/solid/astro/package.json +++ b/examples/solid/astro/package.json @@ -15,8 +15,8 @@ "@astrojs/solid-js": "^4.2.0", "@astrojs/tailwind": "^5.1.0", "@astrojs/vercel": "^7.6.0", - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "astro": "^4.8.6", "solid-js": "^1.8.17", "tailwindcss": "^3.4.3", diff --git a/examples/solid/basic-graphql-request/package.json b/examples/solid/basic-graphql-request/package.json index da6ad684c0..47582ca154 100644 --- a/examples/solid/basic-graphql-request/package.json +++ b/examples/solid/basic-graphql-request/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "graphql": "^16.8.1", "graphql-request": "^7.0.1", "solid-js": "^1.8.17" diff --git a/examples/solid/basic/package.json b/examples/solid/basic/package.json index 4a87efcbe0..9cb37fba06 100644 --- a/examples/solid/basic/package.json +++ b/examples/solid/basic/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "solid-js": "^1.8.17" }, "devDependencies": { diff --git a/examples/solid/default-query-function/package.json b/examples/solid/default-query-function/package.json index 4d96b6b162..e5100392ef 100644 --- a/examples/solid/default-query-function/package.json +++ b/examples/solid/default-query-function/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "solid-js": "^1.8.17" }, "devDependencies": { diff --git a/examples/solid/simple/package.json b/examples/solid/simple/package.json index 4530d31e5c..c778359be6 100644 --- a/examples/solid/simple/package.json +++ b/examples/solid/simple/package.json @@ -9,8 +9,8 @@ "test:types": "tsc" }, "dependencies": { - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "solid-js": "^1.8.17" }, "devDependencies": { diff --git a/examples/solid/solid-start-streaming/package.json b/examples/solid/solid-start-streaming/package.json index 90164cef42..07d02e3355 100644 --- a/examples/solid/solid-start-streaming/package.json +++ b/examples/solid/solid-start-streaming/package.json @@ -12,8 +12,8 @@ "@solidjs/meta": "^0.29.4", "@solidjs/router": "^0.13.3", "@solidjs/start": "^1.0.0-rc.1", - "@tanstack/solid-query": "^5.51.2", - "@tanstack/solid-query-devtools": "^5.51.2", + "@tanstack/solid-query": "^5.51.4", + "@tanstack/solid-query-devtools": "^5.51.4", "solid-js": "^1.8.17", "vinxi": "^0.3.10" }, diff --git a/examples/svelte/auto-refetching/package.json b/examples/svelte/auto-refetching/package.json index b70ba0a5a4..d1ec9430fc 100644 --- a/examples/svelte/auto-refetching/package.json +++ b/examples/svelte/auto-refetching/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/basic/package.json b/examples/svelte/basic/package.json index f73a6499da..4308e59dcd 100644 --- a/examples/svelte/basic/package.json +++ b/examples/svelte/basic/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/load-more-infinite-scroll/package.json b/examples/svelte/load-more-infinite-scroll/package.json index dc7b56a6bd..3c3cd705e4 100644 --- a/examples/svelte/load-more-infinite-scroll/package.json +++ b/examples/svelte/load-more-infinite-scroll/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/optimistic-updates-typescript/package.json b/examples/svelte/optimistic-updates-typescript/package.json index 540264f481..8267e696f3 100644 --- a/examples/svelte/optimistic-updates-typescript/package.json +++ b/examples/svelte/optimistic-updates-typescript/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/playground/package.json b/examples/svelte/playground/package.json index 6baa0ccf96..2e2f99782c 100644 --- a/examples/svelte/playground/package.json +++ b/examples/svelte/playground/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/simple/package.json b/examples/svelte/simple/package.json index af378b8cb2..89a5dc4f5e 100644 --- a/examples/svelte/simple/package.json +++ b/examples/svelte/simple/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^4.0.0-next.3", diff --git a/examples/svelte/ssr/package.json b/examples/svelte/ssr/package.json index e823958419..d1263cb37c 100644 --- a/examples/svelte/ssr/package.json +++ b/examples/svelte/ssr/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/svelte/star-wars/package.json b/examples/svelte/star-wars/package.json index 006f40d27d..b9f50434c8 100644 --- a/examples/svelte/star-wars/package.json +++ b/examples/svelte/star-wars/package.json @@ -9,8 +9,8 @@ "test:types": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "dependencies": { - "@tanstack/svelte-query": "^5.51.1", - "@tanstack/svelte-query-devtools": "^5.51.1" + "@tanstack/svelte-query": "^5.51.4", + "@tanstack/svelte-query-devtools": "^5.51.4" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.2.2", diff --git a/examples/vue/2.6-basic/package.json b/examples/vue/2.6-basic/package.json index ffbcd0ae43..97537b91e2 100644 --- a/examples/vue/2.6-basic/package.json +++ b/examples/vue/2.6-basic/package.json @@ -8,7 +8,7 @@ "_preview": "vite preview" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1", + "@tanstack/vue-query": "^5.51.4", "@vue/composition-api": "1.7.2", "vue": "2.6.14", "vue-template-compiler": "2.6.14" diff --git a/examples/vue/2.7-basic/package.json b/examples/vue/2.7-basic/package.json index 68bd9eaf34..5e87ee8880 100644 --- a/examples/vue/2.7-basic/package.json +++ b/examples/vue/2.7-basic/package.json @@ -8,7 +8,7 @@ "_serve": "vite preview" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1", + "@tanstack/vue-query": "^5.51.4", "vue": "2.7.16", "vue-template-compiler": "2.7.16" }, diff --git a/examples/vue/basic/package.json b/examples/vue/basic/package.json index 643adc1144..0bc2c7cb81 100644 --- a/examples/vue/basic/package.json +++ b/examples/vue/basic/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1", - "@tanstack/vue-query-devtools": "^5.51.1", + "@tanstack/vue-query": "^5.51.4", + "@tanstack/vue-query-devtools": "^5.51.4", "vue": "^3.4.27" }, "devDependencies": { diff --git a/examples/vue/dependent-queries/package.json b/examples/vue/dependent-queries/package.json index a42cf0b635..4f7ec412ec 100644 --- a/examples/vue/dependent-queries/package.json +++ b/examples/vue/dependent-queries/package.json @@ -8,7 +8,7 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1", + "@tanstack/vue-query": "^5.51.4", "vue": "^3.4.27" }, "devDependencies": { diff --git a/examples/vue/nuxt3/package.json b/examples/vue/nuxt3/package.json index b6dff0f906..6ada97b463 100644 --- a/examples/vue/nuxt3/package.json +++ b/examples/vue/nuxt3/package.json @@ -7,7 +7,7 @@ "_start": "node .output/server/index.mjs" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1" + "@tanstack/vue-query": "^5.51.4" }, "devDependencies": { "nuxt": "^3.5.2" diff --git a/examples/vue/persister/package.json b/examples/vue/persister/package.json index 0297c528b3..d8a2d554a0 100644 --- a/examples/vue/persister/package.json +++ b/examples/vue/persister/package.json @@ -8,10 +8,10 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/query-core": "^5.51.1", - "@tanstack/query-persist-client-core": "^5.51.1", - "@tanstack/query-sync-storage-persister": "^5.51.1", - "@tanstack/vue-query": "^5.51.1", + "@tanstack/query-core": "^5.51.4", + "@tanstack/query-persist-client-core": "^5.51.4", + "@tanstack/query-sync-storage-persister": "^5.51.4", + "@tanstack/vue-query": "^5.51.4", "idb-keyval": "^6.2.1", "vue": "^3.4.27" }, diff --git a/examples/vue/simple/package.json b/examples/vue/simple/package.json index 213d446581..1bb7645a52 100644 --- a/examples/vue/simple/package.json +++ b/examples/vue/simple/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "@tanstack/vue-query": "^5.51.1", - "@tanstack/vue-query-devtools": "^5.51.1", + "@tanstack/vue-query": "^5.51.4", + "@tanstack/vue-query-devtools": "^5.51.4", "vue": "^3.4.27" }, "devDependencies": { diff --git a/knip.json b/knip.json index 6eac949264..2e75d9154a 100644 --- a/knip.json +++ b/knip.json @@ -1,5 +1,5 @@ { - "$schema": "https://unpkg.com/knip@4/schema.json", + "$schema": "https://unpkg.com/knip@5/schema.json", "ignore": [".pnpmfile.cjs"], "ignoreWorkspaces": ["examples/**", "integrations/**"], "workspaces": { diff --git a/packages/angular-query-devtools-experimental/package.json b/packages/angular-query-devtools-experimental/package.json index 937161b731..7e3ea6a041 100644 --- a/packages/angular-query-devtools-experimental/package.json +++ b/packages/angular-query-devtools-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/angular-query-devtools-experimental", - "version": "5.51.1", + "version": "5.51.4", "description": "Developer tools to interact with and visualize the TanStack/angular-query cache", "author": "Arnoud de Vries", "license": "MIT", diff --git a/packages/angular-query-experimental/package.json b/packages/angular-query-experimental/package.json index 089a73d930..4d6d024f95 100644 --- a/packages/angular-query-experimental/package.json +++ b/packages/angular-query-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/angular-query-experimental", - "version": "5.51.1", + "version": "5.51.4", "description": "Signals for managing, caching and syncing asynchronous and remote data in Angular", "author": "Arnoud de Vries", "license": "MIT", diff --git a/packages/query-async-storage-persister/package.json b/packages/query-async-storage-persister/package.json index ab8e0c8ee9..cc6b7e7b1c 100644 --- a/packages/query-async-storage-persister/package.json +++ b/packages/query-async-storage-persister/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/query-async-storage-persister", - "version": "5.51.1", + "version": "5.51.4", "description": "A persister for asynchronous storages, to be used with TanStack/Query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/query-broadcast-client-experimental/package.json b/packages/query-broadcast-client-experimental/package.json index 6060e80075..6ea4a4e589 100644 --- a/packages/query-broadcast-client-experimental/package.json +++ b/packages/query-broadcast-client-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/query-broadcast-client-experimental", - "version": "5.51.1", + "version": "5.51.4", "description": "An experimental plugin to for broadcasting the state of your queryClient between browser tabs/windows", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/query-core/package.json b/packages/query-core/package.json index a1b6adb93a..3ef2c52844 100644 --- a/packages/query-core/package.json +++ b/packages/query-core/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/query-core", - "version": "5.51.1", + "version": "5.51.4", "description": "The framework agnostic core that powers TanStack Query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/query-core/src/__tests__/infiniteQueryObserver.test.tsx b/packages/query-core/src/__tests__/infiniteQueryObserver.test.tsx index cdc0049ee8..334e3a5550 100644 --- a/packages/query-core/src/__tests__/infiniteQueryObserver.test.tsx +++ b/packages/query-core/src/__tests__/infiniteQueryObserver.test.tsx @@ -103,6 +103,41 @@ describe('InfiniteQueryObserver', () => { expect(all).toEqual(['next0', 'next0,1', 'prev0,1']) }) + test('should not invoke getNextPageParam and getPreviousPageParam on empty pages', async () => { + const key = queryKey() + + const getNextPageParam = vi.fn() + const getPreviousPageParam = vi.fn() + + const observer = new InfiniteQueryObserver(queryClient, { + queryKey: key, + queryFn: ({ pageParam }) => String(pageParam), + initialPageParam: 1, + getNextPageParam: getNextPageParam.mockImplementation( + (_, __, lastPageParam) => { + return lastPageParam + 1 + }, + ), + getPreviousPageParam: getPreviousPageParam.mockImplementation( + (_, __, firstPageParam) => { + return firstPageParam - 1 + }, + ), + }) + + const unsubscribe = observer.subscribe(() => {}) + + getNextPageParam.mockClear() + getPreviousPageParam.mockClear() + + queryClient.setQueryData(key, { pages: [], pageParams: [] }) + + expect(getNextPageParam).toHaveBeenCalledTimes(0) + expect(getPreviousPageParam).toHaveBeenCalledTimes(0) + + unsubscribe() + }) + test('should stop refetching if undefined is returned from getNextPageParam', async () => { const key = queryKey() let next: number | undefined = 2 diff --git a/packages/query-core/src/__tests__/utils.ts b/packages/query-core/src/__tests__/utils.ts index 1beace1bde..8d876afc3c 100644 --- a/packages/query-core/src/__tests__/utils.ts +++ b/packages/query-core/src/__tests__/utils.ts @@ -32,11 +32,11 @@ export function sleep(timeout: number): Promise { }) } -export const executeMutation = ( +export function executeMutation( queryClient: QueryClient, options: MutationOptions, variables: TVariables, -) => { +) { return queryClient .getMutationCache() .build(queryClient, options) diff --git a/packages/query-core/src/infiniteQueryBehavior.ts b/packages/query-core/src/infiniteQueryBehavior.ts index 57bcfa2312..90bf8af2a4 100644 --- a/packages/query-core/src/infiniteQueryBehavior.ts +++ b/packages/query-core/src/infiniteQueryBehavior.ts @@ -133,24 +133,23 @@ function getNextPageParam( { pages, pageParams }: InfiniteData, ): unknown | undefined { const lastIndex = pages.length - 1 - return options.getNextPageParam( - pages[lastIndex], - pages, - pageParams[lastIndex], - pageParams, - ) + return pages.length > 0 + ? options.getNextPageParam( + pages[lastIndex], + pages, + pageParams[lastIndex], + pageParams, + ) + : undefined } function getPreviousPageParam( options: InfiniteQueryPageParamsOptions, { pages, pageParams }: InfiniteData, ): unknown | undefined { - return options.getPreviousPageParam?.( - pages[0], - pages, - pageParams[0], - pageParams, - ) + return pages.length > 0 + ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) + : undefined } /** diff --git a/packages/query-core/src/utils.ts b/packages/query-core/src/utils.ts index 8b498ae1e4..f84fdcd775 100644 --- a/packages/query-core/src/utils.ts +++ b/packages/query-core/src/utils.ts @@ -340,9 +340,9 @@ function hasObjectPrototype(o: any): boolean { return Object.prototype.toString.call(o) === '[object Object]' } -export function sleep(ms: number): Promise { +export function sleep(timeout: number): Promise { return new Promise((resolve) => { - setTimeout(resolve, ms) + setTimeout(resolve, timeout) }) } @@ -378,7 +378,7 @@ export function addToStart(items: Array, item: T, max = 0): Array { export const skipToken = Symbol() export type SkipToken = typeof skipToken -export const ensureQueryFn = < +export function ensureQueryFn< TQueryFnData = unknown, TQueryKey extends QueryKey = QueryKey, >( @@ -387,7 +387,7 @@ export const ensureQueryFn = < queryHash?: string }, fetchOptions?: FetchOptions, -): QueryFunction => { +): QueryFunction { if (process.env.NODE_ENV !== 'production') { if (options.queryFn === skipToken) { console.error( diff --git a/packages/query-persist-client-core/package.json b/packages/query-persist-client-core/package.json index 2ceb5ac923..63b35532c7 100644 --- a/packages/query-persist-client-core/package.json +++ b/packages/query-persist-client-core/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/query-persist-client-core", - "version": "5.51.1", + "version": "5.51.4", "description": "Set of utilities for interacting with persisters, which can save your queryClient for later use", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/query-persist-client-core/src/__tests__/utils.ts b/packages/query-persist-client-core/src/__tests__/utils.ts index 7f05c27545..d633cf7268 100644 --- a/packages/query-persist-client-core/src/__tests__/utils.ts +++ b/packages/query-persist-client-core/src/__tests__/utils.ts @@ -13,7 +13,7 @@ export function sleep(timeout: number): Promise { }) } -export const createMockPersister = (): Persister => { +export function createMockPersister(): Persister { let storedState: PersistedClient | undefined return { @@ -30,7 +30,7 @@ export const createMockPersister = (): Persister => { } } -export const createSpyPersister = (): Persister => { +export function createSpyPersister(): Persister { return { persistClient: vi.fn(), restoreClient: vi.fn(), diff --git a/packages/query-sync-storage-persister/package.json b/packages/query-sync-storage-persister/package.json index 4bd16ff255..43d6d638d5 100644 --- a/packages/query-sync-storage-persister/package.json +++ b/packages/query-sync-storage-persister/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/query-sync-storage-persister", - "version": "5.51.1", + "version": "5.51.4", "description": "A persister for synchronous storages, to be used with TanStack/Query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/react-query-devtools/package.json b/packages/react-query-devtools/package.json index 9ae289d50e..e7d01104f0 100644 --- a/packages/react-query-devtools/package.json +++ b/packages/react-query-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/react-query-devtools", - "version": "5.51.1", + "version": "5.51.4", "description": "Developer tools to interact with and visualize the TanStack/react-query cache", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/react-query-next-experimental/package.json b/packages/react-query-next-experimental/package.json index 0c0cccaee1..9a87077e56 100644 --- a/packages/react-query-next-experimental/package.json +++ b/packages/react-query-next-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/react-query-next-experimental", - "version": "5.51.1", + "version": "5.51.4", "description": "Hydration utils for React Query in the NextJs app directory", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/react-query-persist-client/package.json b/packages/react-query-persist-client/package.json index 9b8c2225cb..93d26b46b8 100644 --- a/packages/react-query-persist-client/package.json +++ b/packages/react-query-persist-client/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/react-query-persist-client", - "version": "5.51.1", + "version": "5.51.4", "description": "React bindings to work with persisters in TanStack/react-query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/react-query/package.json b/packages/react-query/package.json index b393fc07be..a60ce3639e 100644 --- a/packages/react-query/package.json +++ b/packages/react-query/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/react-query", - "version": "5.51.1", + "version": "5.51.4", "description": "Hooks for managing, caching and syncing asynchronous and remote data in React", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/react-query/src/__tests__/utils.tsx b/packages/react-query/src/__tests__/utils.tsx index 4544c39a3c..7e25177768 100644 --- a/packages/react-query/src/__tests__/utils.tsx +++ b/packages/react-query/src/__tests__/utils.tsx @@ -22,13 +22,13 @@ export function renderWithClient( } as any } -export const Blink = ({ +export function Blink({ duration, children, }: { duration: number children: React.ReactNode -}) => { +}) { const [shouldShow, setShouldShow] = React.useState(true) React.useEffect(() => { diff --git a/packages/solid-query-devtools/package.json b/packages/solid-query-devtools/package.json index 0862ef2715..23003e5686 100644 --- a/packages/solid-query-devtools/package.json +++ b/packages/solid-query-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query-devtools", - "version": "5.51.2", + "version": "5.51.4", "description": "Developer tools to interact with and visualize the TanStack/solid-query Query cache", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/solid-query-persist-client/package.json b/packages/solid-query-persist-client/package.json index eefc9164e2..2665f69625 100644 --- a/packages/solid-query-persist-client/package.json +++ b/packages/solid-query-persist-client/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query-persist-client", - "version": "5.51.2", + "version": "5.51.4", "description": "Solid.js bindings to work with persisters in TanStack/solid-query", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/solid-query/package.json b/packages/solid-query/package.json index 7040cb759f..ba07b1ca3b 100644 --- a/packages/solid-query/package.json +++ b/packages/solid-query/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/solid-query", - "version": "5.51.2", + "version": "5.51.4", "description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/solid-query/src/__tests__/utils.tsx b/packages/solid-query/src/__tests__/utils.tsx index 7cfaff843f..98bd80b57e 100644 --- a/packages/solid-query/src/__tests__/utils.tsx +++ b/packages/solid-query/src/__tests__/utils.tsx @@ -12,11 +12,11 @@ export function queryKey() { return [`query_${queryKeyCount}`] } -export const Blink = ( +export function Blink( props: { duration: number } & ParentProps, -) => { +) { const [shouldShow, setShouldShow] = createSignal(true) createEffect(() => { diff --git a/packages/svelte-query-devtools/package.json b/packages/svelte-query-devtools/package.json index 3edeba5639..472ed1091f 100644 --- a/packages/svelte-query-devtools/package.json +++ b/packages/svelte-query-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/svelte-query-devtools", - "version": "5.51.1", + "version": "5.51.4", "description": "Developer tools to interact with and visualize the TanStack/svelte-query cache", "author": "Lachlan Collins", "license": "MIT", diff --git a/packages/svelte-query-persist-client/package.json b/packages/svelte-query-persist-client/package.json index 3facc4eb60..d50a6c1d34 100644 --- a/packages/svelte-query-persist-client/package.json +++ b/packages/svelte-query-persist-client/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/svelte-query-persist-client", - "version": "5.51.1", + "version": "5.51.4", "description": "Svelte bindings to work with persisters in TanStack/svelte-query", "author": "Lachlan Collins", "license": "MIT", diff --git a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte index cf8764a015..c0f7c45de6 100644 --- a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte +++ b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/AwaitOnSuccess.svelte @@ -2,10 +2,10 @@ import { createQuery } from '@tanstack/svelte-query' import { sleep } from '../utils.svelte' - let { key, states }: { key: Array; states: Array } = $props() + let { states }: { states: Array } = $props() - const state = createQuery({ - queryKey: key, + const query = createQuery({ + queryKey: ['test'], queryFn: async () => { states.push('fetching') await sleep(10) @@ -15,7 +15,5 @@ }) -
-

{state.data}

-

fetchStatus: {state.fetchStatus}

-
+
{query.data}
+
fetchStatus: {query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/Provider.svelte b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/Provider.svelte index a717a2357f..7d1201e0da 100644 --- a/packages/svelte-query-persist-client/tests/AwaitOnSuccess/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/AwaitOnSuccess/Provider.svelte @@ -7,14 +7,13 @@ interface Props { queryClient: QueryClient persistOptions: OmitKeyof - key: Array onSuccess: () => Promise states: Array } - let { queryClient, persistOptions, key, onSuccess, states }: Props = $props() + let { queryClient, persistOptions, onSuccess, states }: Props = $props() - + diff --git a/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte b/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte index 790126d48f..7c8d7d9a6e 100644 --- a/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte +++ b/packages/svelte-query-persist-client/tests/FreshData/FreshData.svelte @@ -14,7 +14,7 @@ } = $props() const query = createQuery({ - queryKey: key, + queryKey: ['test'], queryFn: async () => { states.value.push('fetched') await sleep(10) @@ -23,12 +23,11 @@ staleTime: Infinity, }) + $effect(() => { states.value = [...untrack(() => states.value), $state.snapshot(query)] }) -
-

data: {query.data ?? 'null'}

-

fetchStatus: {query.fetchStatus}

-
+
data: {$query.data ?? 'null'}
+
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte b/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte index 3716a08b11..68d936293c 100644 --- a/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte +++ b/packages/svelte-query-persist-client/tests/InitialData/InitialData.svelte @@ -13,7 +13,7 @@ } = $props() const query = createQuery({ - queryKey: key, + queryKey: ['test'], queryFn: async () => { await sleep(10) return 'fetched' @@ -30,7 +30,5 @@ }) -
-

{query.data}

-

fetchStatus: {query.fetchStatus}

-
+
{$query.data}
+
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/InitialData/Provider.svelte b/packages/svelte-query-persist-client/tests/InitialData/Provider.svelte index 51250ac5dc..e351d1cc62 100644 --- a/packages/svelte-query-persist-client/tests/InitialData/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/InitialData/Provider.svelte @@ -16,5 +16,5 @@ - + diff --git a/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte b/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte index f1e5a81421..88f3a90eec 100644 --- a/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte +++ b/packages/svelte-query-persist-client/tests/OnSuccess/OnSuccess.svelte @@ -2,14 +2,8 @@ import { createQuery } from '@tanstack/svelte-query' import { sleep } from '../utils.svelte' - interface Props { - key: Array - } - - let { key }: Props = $props() - - const state = createQuery({ - queryKey: key, + const query = createQuery({ + queryKey: ['test'], queryFn: async () => { await sleep(10) return 'fetched' @@ -17,7 +11,5 @@ }) -
-

{state.data}

-

fetchStatus: {state.fetchStatus}

-
+
{$query.data}
+
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/OnSuccess/Provider.svelte b/packages/svelte-query-persist-client/tests/OnSuccess/Provider.svelte index 98313ec8b3..0655c601a2 100644 --- a/packages/svelte-query-persist-client/tests/OnSuccess/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/OnSuccess/Provider.svelte @@ -15,5 +15,5 @@ - + diff --git a/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts b/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts index 00bf560d99..8a78dd6c57 100644 --- a/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts +++ b/packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts @@ -54,12 +54,11 @@ const createMockErrorPersister = ( describe('PersistQueryClientProvider', () => { test('restores cache from persister', async () => { - const key = queryKey() let states = ref>>([]) const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -73,7 +72,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, states, }, }) @@ -110,12 +108,11 @@ describe('PersistQueryClientProvider', () => { }) test('should also put useQueries into idle state', async () => { - const key = queryKey() let states = ref>>([]) const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -129,7 +126,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, states, }, }) @@ -160,12 +156,11 @@ describe('PersistQueryClientProvider', () => { }) test('should show initialData while restoring', async () => { - const key = queryKey() let states = ref>>([]) const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -179,7 +174,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, states, }, }) @@ -216,12 +210,11 @@ describe('PersistQueryClientProvider', () => { }) test('should not refetch after restoring when data is fresh', async () => { - const key = queryKey() let states = ref>>([]) const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -237,7 +230,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, states, fetched, }, @@ -264,11 +256,9 @@ describe('PersistQueryClientProvider', () => { }) test('should call onSuccess after successful restoring', async () => { - const key = queryKey() - const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -284,7 +274,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, onSuccess, }, }) @@ -297,11 +286,9 @@ describe('PersistQueryClientProvider', () => { }) test('should await onSuccess after successful restoring', async () => { - const key = queryKey() - const queryClient = createQueryClient() await queryClient.prefetchQuery({ - queryKey: key, + queryKey: ['test'], queryFn: () => Promise.resolve('hydrated'), }) @@ -317,7 +304,6 @@ describe('PersistQueryClientProvider', () => { props: { queryClient, persistOptions: { persister }, - key, states, onSuccess: async () => { states.push('onSuccess') @@ -339,7 +325,6 @@ describe('PersistQueryClientProvider', () => { }) test('should remove cache after non-successful restoring', async () => { - const key = queryKey() const consoleMock = vi.spyOn(console, 'error') const consoleWarn = vi .spyOn(console, 'warn') @@ -352,7 +337,7 @@ describe('PersistQueryClientProvider', () => { const [error, persister] = createMockErrorPersister(removeClient) const rendered = render(RemoveCache, { - props: { queryClient, persistOptions: { persister }, key }, + props: { queryClient, persistOptions: { persister } }, }) await waitFor(() => rendered.getByText('fetched')) diff --git a/packages/svelte-query-persist-client/tests/RemoveCache/Provider.svelte b/packages/svelte-query-persist-client/tests/RemoveCache/Provider.svelte index 8d146a01aa..f71e987249 100644 --- a/packages/svelte-query-persist-client/tests/RemoveCache/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/RemoveCache/Provider.svelte @@ -14,5 +14,5 @@ - + diff --git a/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte b/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte index f1e5a81421..88f3a90eec 100644 --- a/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte +++ b/packages/svelte-query-persist-client/tests/RemoveCache/RemoveCache.svelte @@ -2,14 +2,8 @@ import { createQuery } from '@tanstack/svelte-query' import { sleep } from '../utils.svelte' - interface Props { - key: Array - } - - let { key }: Props = $props() - - const state = createQuery({ - queryKey: key, + const query = createQuery({ + queryKey: ['test'], queryFn: async () => { await sleep(10) return 'fetched' @@ -17,7 +11,5 @@ }) -
-

{state.data}

-

fetchStatus: {state.fetchStatus}

-
+
{$query.data}
+
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/RestoreCache/Provider.svelte b/packages/svelte-query-persist-client/tests/RestoreCache/Provider.svelte index fbe8038257..6d7fd80942 100644 --- a/packages/svelte-query-persist-client/tests/RestoreCache/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/RestoreCache/Provider.svelte @@ -16,5 +16,5 @@ - + diff --git a/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte b/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte index 876541bc3f..008e71f4fc 100644 --- a/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte +++ b/packages/svelte-query-persist-client/tests/RestoreCache/RestoreCache.svelte @@ -13,7 +13,7 @@ } = $props() const query = createQuery({ - queryKey: key, + queryKey: ['test'], queryFn: async () => { await sleep(10) return 'fetched' @@ -25,7 +25,5 @@ }) -
-

{query.data}

-

fetchStatus: {query.fetchStatus}

-
+
{$query.data}
+
fetchStatus: {$query.fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/UseQueries/Provider.svelte b/packages/svelte-query-persist-client/tests/UseQueries/Provider.svelte index 06e67de7d7..3d3e954b9c 100644 --- a/packages/svelte-query-persist-client/tests/UseQueries/Provider.svelte +++ b/packages/svelte-query-persist-client/tests/UseQueries/Provider.svelte @@ -16,5 +16,5 @@ - + diff --git a/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte b/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte index d603acefdd..70818781d4 100644 --- a/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte +++ b/packages/svelte-query-persist-client/tests/UseQueries/UseQueries.svelte @@ -12,10 +12,10 @@ states: { value: Array> } } = $props() - const s = createQueries({ + const queries = createQueries({ queries: [ { - queryKey: key, + queryKey: ['test'], queryFn: async (): Promise => { await sleep(10) return 'fetched' @@ -29,7 +29,5 @@ }) -
-

{s[0].data}

-

fetchStatus: {s[0].fetchStatus}

-
+
{$queries[0].data}
+
fetchStatus: {$queries[0].fetchStatus}
diff --git a/packages/svelte-query-persist-client/tests/utils.svelte.ts b/packages/svelte-query-persist-client/tests/utils.svelte.ts index 2518fee2d1..8e59db6139 100644 --- a/packages/svelte-query-persist-client/tests/utils.svelte.ts +++ b/packages/svelte-query-persist-client/tests/utils.svelte.ts @@ -6,12 +6,6 @@ export function createQueryClient(config?: QueryClientConfig): QueryClient { return new QueryClient(config) } -let queryKeyCount = 0 -export function queryKey(): Array { - queryKeyCount++ - return [`query_${queryKeyCount}`] -} - export function sleep(timeout: number): Promise { return new Promise((resolve, _reject) => { setTimeout(resolve, timeout) diff --git a/packages/svelte-query/package.json b/packages/svelte-query/package.json index 5da64e2fc1..955a97aceb 100644 --- a/packages/svelte-query/package.json +++ b/packages/svelte-query/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/svelte-query", - "version": "5.51.1", + "version": "5.51.4", "description": "Primitives for managing, caching and syncing asynchronous and remote data in Svelte", "author": "Lachlan Collins", "license": "MIT", diff --git a/packages/svelte-query/tests/QueryClientProvider/ChildComponent.svelte b/packages/svelte-query/tests/QueryClientProvider/ChildComponent.svelte index 7cebabec0f..003f7f9e2f 100644 --- a/packages/svelte-query/tests/QueryClientProvider/ChildComponent.svelte +++ b/packages/svelte-query/tests/QueryClientProvider/ChildComponent.svelte @@ -5,10 +5,10 @@ const query = createQuery({ queryKey: ['hello'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'test' }, }) -
{query.data}
+
Data: {query.data ?? 'undefined'}
diff --git a/packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.test.ts b/packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.test.ts index 86c9907cb7..f144e1c9f9 100644 --- a/packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.test.ts +++ b/packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.test.ts @@ -13,7 +13,7 @@ describe('QueryClientProvider', () => { }, }) - await waitFor(() => rendered.getByText('test')) + await waitFor(() => rendered.getByText('Data: test')) expect(queryCache.find({ queryKey: ['hello'] })).toBeDefined() }) diff --git a/packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte b/packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte index ab6b402b32..cd36ff55b7 100644 --- a/packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte +++ b/packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte @@ -1,7 +1,11 @@ -
Data: {JSON.stringify(query.data) || 'undefined'}
Status: {query.status}
diff --git a/packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.test.ts b/packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.test.ts index 6fc8fecf02..bc05d86b78 100644 --- a/packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.test.ts +++ b/packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.test.ts @@ -1,18 +1,93 @@ -import { describe, test } from 'vitest' -import { render } from '@testing-library/svelte' - -import { sleep } from '../utils.svelte' +import { describe, expect, test } from 'vitest' +import { render, waitFor } from '@testing-library/svelte' +import { ref } from '../utils.svelte' import BaseExample from './BaseExample.svelte' +import type { QueryObserverResult } from '@tanstack/query-core' + +describe('createInfiniteQuery', () => { + test('Return the correct states for a successful query', async () => { + let states = ref>([]) + + const rendered = render(BaseExample, { + props: { + states, + }, + }) + + await waitFor(() => { + expect(rendered.queryByText('Status: success')).toBeInTheDocument() + }) -describe('createQuery', () => { - test('Render and wait for success', async () => { - const rendered = render(BaseExample) + expect(states.value).toHaveLength(2) - await rendered.findByText('Data: undefined') - await rendered.findByText('Status: pending') - await sleep(20) + expect(states.value[0]).toEqual({ + data: undefined, + dataUpdatedAt: 0, + error: null, + errorUpdatedAt: 0, + failureCount: 0, + failureReason: null, + errorUpdateCount: 0, + fetchNextPage: expect.any(Function), + fetchPreviousPage: expect.any(Function), + hasNextPage: false, + hasPreviousPage: false, + isError: false, + isFetched: false, + isFetchedAfterMount: false, + isFetching: true, + isPaused: false, + isFetchNextPageError: false, + isFetchingNextPage: false, + isFetchPreviousPageError: false, + isFetchingPreviousPage: false, + isLoading: true, + isPending: true, + isInitialLoading: true, + isLoadingError: false, + isPlaceholderData: false, + isRefetchError: false, + isRefetching: false, + isStale: true, + isSuccess: false, + refetch: expect.any(Function), + status: 'pending', + fetchStatus: 'fetching', + }) - await rendered.findByText('Data: {"pages":[0],"pageParams":[0]}') - await rendered.findByText('Status: success') + expect(states.value[1]).toEqual({ + data: { pages: [0], pageParams: [0] }, + dataUpdatedAt: expect.any(Number), + error: null, + errorUpdatedAt: 0, + failureCount: 0, + failureReason: null, + errorUpdateCount: 0, + fetchNextPage: expect.any(Function), + fetchPreviousPage: expect.any(Function), + hasNextPage: true, + hasPreviousPage: false, + isError: false, + isFetched: true, + isFetchedAfterMount: true, + isFetching: false, + isPaused: false, + isFetchNextPageError: false, + isFetchingNextPage: false, + isFetchPreviousPageError: false, + isFetchingPreviousPage: false, + isLoading: false, + isPending: false, + isInitialLoading: false, + isLoadingError: false, + isPlaceholderData: false, + isRefetchError: false, + isRefetching: false, + isStale: true, + isSuccess: true, + refetch: expect.any(Function), + status: 'success', + fetchStatus: 'idle', + }) }) }) diff --git a/packages/svelte-query/tests/createQueries/BaseExample.svelte b/packages/svelte-query/tests/createQueries/BaseExample.svelte index f5cb08afff..c5686f7d83 100644 --- a/packages/svelte-query/tests/createQueries/BaseExample.svelte +++ b/packages/svelte-query/tests/createQueries/BaseExample.svelte @@ -20,16 +20,7 @@ const queries = createQueries(options, queryClient) -{#if Array.isArray(queries)} - {#each queries as query, index} - {#if query.isPending} -
Loading {index + 1}
- {:else if query.isSuccess} -
{query.data}
- {/if} - {/each} -{:else if queries.isPending} -
Loading
-{:else if queries.isSuccess} -
{queries.data}
-{/if} +{#each queries as query, index} +
Status {index + 1}: {query.status}
+
Data {index + 1}: {query.data}
+{/each} diff --git a/packages/svelte-query/tests/createQueries/CombineExample.svelte b/packages/svelte-query/tests/createQueries/CombineExample.svelte new file mode 100644 index 0000000000..7ff5058848 --- /dev/null +++ b/packages/svelte-query/tests/createQueries/CombineExample.svelte @@ -0,0 +1,32 @@ + + +
isPending: {queries.isPending}
+
Data: {queries.data ?? 'undefined'}
diff --git a/packages/svelte-query/tests/createQueries/createQueries.test.ts b/packages/svelte-query/tests/createQueries/createQueries.test.ts index f3ce4af95c..5f1ffa21dd 100644 --- a/packages/svelte-query/tests/createQueries/createQueries.test.ts +++ b/packages/svelte-query/tests/createQueries/createQueries.test.ts @@ -3,6 +3,7 @@ import { render, waitFor } from '@testing-library/svelte' import { QueryClient } from '@tanstack/query-core' import { sleep } from '../utils.svelte' import BaseExample from './BaseExample.svelte' +import CombineExample from './CombineExample.svelte' describe('createQueries', () => { test('Render and wait for success', async () => { @@ -13,14 +14,14 @@ describe('createQueries', () => { { queryKey: ['key-1'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'Success 1' }, }, { queryKey: ['key-2'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'Success 2' }, }, @@ -31,47 +32,29 @@ describe('createQueries', () => { }) await waitFor(() => { - expect(rendered.getByText('Loading 1')).toBeInTheDocument() - expect(rendered.getByText('Loading 2')).toBeInTheDocument() + expect(rendered.getByText('Status 1: pending')).toBeInTheDocument() + expect(rendered.getByText('Status 2: pending')).toBeInTheDocument() }) await waitFor(() => { - expect(rendered.getByText('Success 1')).toBeInTheDocument() - expect(rendered.getByText('Success 2')).toBeInTheDocument() + expect(rendered.getByText('Status 1: success')).toBeInTheDocument() + expect(rendered.getByText('Status 2: success')).toBeInTheDocument() }) }) test('Combine queries', async () => { - const ids = [1, 2, 3] - - const rendered = render(BaseExample, { + const rendered = render(CombineExample, { props: { - options: { - queries: ids.map((id) => ({ - queryKey: [id], - queryFn: async () => { - await sleep(10) - return id - }, - })), - combine: (results) => { - return { - isPending: results.some((result) => result.isPending), - isSuccess: results.every((result) => result.isSuccess), - data: results.map((res) => res.data).join(','), - } - }, - }, queryClient: new QueryClient(), }, }) await waitFor(() => { - expect(rendered.getByText('Loading')).toBeInTheDocument() + expect(rendered.getByText('isPending: true')).toBeInTheDocument() }) await waitFor(() => { - expect(rendered.getByText('1,2,3')).toBeInTheDocument() + expect(rendered.getByText('Data: 1,2,3')).toBeInTheDocument() }) }) }) diff --git a/packages/svelte-query/tests/createQuery/BaseExample.svelte b/packages/svelte-query/tests/createQuery/BaseExample.svelte index bda0f8940e..ef81bdf065 100644 --- a/packages/svelte-query/tests/createQuery/BaseExample.svelte +++ b/packages/svelte-query/tests/createQuery/BaseExample.svelte @@ -23,11 +23,4 @@
Status: {query.status}
Failure Count: {query.failureCount}
- -{#if query.isPending} -
Loading
-{:else if query.isError} -
Error
-{:else if query.isSuccess} -
{query.data}
-{/if} +
Data: {query.data ?? 'undefined'}
diff --git a/packages/svelte-query/tests/createQuery/DisabledExample.svelte b/packages/svelte-query/tests/createQuery/DisabledExample.svelte index 4eba0fb0a3..1f64690651 100644 --- a/packages/svelte-query/tests/createQuery/DisabledExample.svelte +++ b/packages/svelte-query/tests/createQuery/DisabledExample.svelte @@ -1,14 +1,21 @@ +
Data: {query.data ?? 'undefined'}
Count: {count}
diff --git a/packages/svelte-query/tests/createQuery/PlaceholderData.svelte b/packages/svelte-query/tests/createQuery/PlaceholderData.svelte index afa9e23737..e119195841 100644 --- a/packages/svelte-query/tests/createQuery/PlaceholderData.svelte +++ b/packages/svelte-query/tests/createQuery/PlaceholderData.svelte @@ -17,7 +17,7 @@ const options = $derived(() => ({ queryKey: ['test', count], queryFn: async () => { - await sleep(10) + await sleep(5) return count }, placeholderData: keepPreviousData, @@ -33,4 +33,4 @@
Status: {query.status}
-
Data: {query.data}
+
Data: {query.data ?? 'undefined'}
diff --git a/packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts b/packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts index ef9f95ca91..1480953df4 100644 --- a/packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts +++ b/packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts @@ -14,7 +14,7 @@ describe('createQuery', () => { const options = { queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'Success' }, } @@ -28,7 +28,7 @@ describe('createQuery', () => { }) await waitFor(() => { - expect(rendered.queryByText('Success')).toBeInTheDocument() + expect(rendered.queryByText('Status: success')).toBeInTheDocument() }) expect(states.value).toHaveLength(2) @@ -198,7 +198,7 @@ describe('createQuery', () => { const optionsStore = $state({ queryKey: ['test'], queryFn: async () => { - await sleep(10) + await sleep(5) return 'Success' }, }) @@ -212,7 +212,7 @@ describe('createQuery', () => { }) await waitFor(() => { - expect(rendered.queryByText('Success')).toBeInTheDocument() + expect(rendered.queryByText('Status: success')).toBeInTheDocument() }) }) @@ -224,7 +224,7 @@ describe('createQuery', () => { const derivedStore = $derived(() => ({ queryKey: [writableStore], queryFn: async () => { - await sleep(10) + await sleep(5) return 'Success' }, })) @@ -238,7 +238,7 @@ describe('createQuery', () => { }) await waitFor(() => { - expect(rendered.queryByText('Success')).toBeInTheDocument() + expect(rendered.queryByText('Status: success')).toBeInTheDocument() }) }) @@ -250,8 +250,8 @@ describe('createQuery', () => { const derivedStore = $derived({ queryKey: () => [writableStore], queryFn: async () => { - await sleep(50) - return `Success ${writableStore}` + await sleep(5) + return writableStore }, }) @@ -266,22 +266,22 @@ describe('createQuery', () => { }) await waitFor(() => { - expect(rendered.queryByText('Success 1')).toBeInTheDocument() - expect(rendered.queryByText('Success 2')).not.toBeInTheDocument() + expect(rendered.queryByText('Data: 1')).toBeInTheDocument() + expect(rendered.queryByText('Data: 2')).not.toBeInTheDocument() }) writableStore = 2 await waitFor(() => { - expect(rendered.queryByText('Success 1')).not.toBeInTheDocument() - expect(rendered.queryByText('Success 2')).toBeInTheDocument() + expect(rendered.queryByText('Data: 1')).not.toBeInTheDocument() + expect(rendered.queryByText('Data: 2')).toBeInTheDocument() }) writableStore = 1 await waitFor(() => { - expect(rendered.queryByText('Success 1')).toBeInTheDocument() - expect(rendered.queryByText('Success 2')).not.toBeInTheDocument() + expect(rendered.queryByText('Data: 1')).toBeInTheDocument() + expect(rendered.queryByText('Data: 2')).not.toBeInTheDocument() }) }) @@ -310,6 +310,7 @@ describe('createQuery', () => { isSuccess: false, isPlaceholderData: false, }) + // Fetched expect(states.value[1]).toMatchObject({ data: 0, @@ -317,6 +318,7 @@ describe('createQuery', () => { isSuccess: true, isPlaceholderData: false, }) + // Set state expect(states.value[2]).toMatchObject({ data: 0, @@ -324,6 +326,7 @@ describe('createQuery', () => { isSuccess: true, isPlaceholderData: true, }) + // New data expect(states.value[3]).toMatchObject({ data: 1, @@ -334,9 +337,15 @@ describe('createQuery', () => { }) test('Should not fetch when switching to a disabled query', async () => { - const rendered = render(DisabledExample) + let states = ref>([]) - await waitFor(() => rendered.getByText('Data: undefined')) + const rendered = render(DisabledExample, { + props: { + states, + }, + }) + + await waitFor(() => rendered.getByText('Data: 0')) fireEvent.click(rendered.getByRole('button', { name: /Increment/i })) @@ -344,5 +353,28 @@ describe('createQuery', () => { rendered.getByText('Count: 0') rendered.getByText('Data: 0') }) + + expect(states.value).toHaveLength(3) + + // Fetch query + expect(states.value[0]).toMatchObject({ + data: undefined, + isFetching: true, + isSuccess: false, + }) + + // Fetched query + expect(states.value[1]).toMatchObject({ + data: 0, + isFetching: false, + isSuccess: true, + }) + + // Switch to disabled query + expect(states.value[2]).toMatchObject({ + data: undefined, + isFetching: false, + isSuccess: false, + }) }) }) diff --git a/packages/svelte-query/tests/useIsFetching/BaseExample.svelte b/packages/svelte-query/tests/useIsFetching/BaseExample.svelte index 7307e263c7..6847e54c0f 100644 --- a/packages/svelte-query/tests/useIsFetching/BaseExample.svelte +++ b/packages/svelte-query/tests/useIsFetching/BaseExample.svelte @@ -1,19 +1,18 @@ +
isFetching: {isFetching()}
-{ready} -{#if query.isSuccess} - {query.data} -{/if} +
Data: {query.data ?? 'undefined'}
diff --git a/packages/svelte-query/tests/useIsMutating/BaseExample.svelte b/packages/svelte-query/tests/useIsMutating/BaseExample.svelte index 3f0fcdf45e..b2d71d8760 100644 --- a/packages/svelte-query/tests/useIsMutating/BaseExample.svelte +++ b/packages/svelte-query/tests/useIsMutating/BaseExample.svelte @@ -9,9 +9,9 @@ const mutation = createMutation( { - mutationKey: ['mutation1'], + mutationKey: ['mutation-1'], mutationFn: async () => { - await sleep(20) + await sleep(5) return 'data' }, }, diff --git a/packages/svelte-query/tests/utils.svelte.ts b/packages/svelte-query/tests/utils.svelte.ts index 85bb50147b..c31dde0389 100644 --- a/packages/svelte-query/tests/utils.svelte.ts +++ b/packages/svelte-query/tests/utils.svelte.ts @@ -4,13 +4,6 @@ export function sleep(timeout: number): Promise { }) } -let queryKeyCount = 0 - -export function queryKey(): string { - queryKeyCount += 1 - return `query_${queryKeyCount}` -} - export function ref(initial: T) { let value = $state(initial) diff --git a/packages/vue-query-devtools/package.json b/packages/vue-query-devtools/package.json index 6de48633c6..59ec97f7ab 100644 --- a/packages/vue-query-devtools/package.json +++ b/packages/vue-query-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/vue-query-devtools", - "version": "5.51.1", + "version": "5.51.4", "description": "Developer tools to interact with and visualize the TanStack/vue-query cache", "author": "tannerlinsley", "license": "MIT", diff --git a/packages/vue-query/package.json b/packages/vue-query/package.json index 19573f0567..22f0e3cb39 100644 --- a/packages/vue-query/package.json +++ b/packages/vue-query/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/vue-query", - "version": "5.51.1", + "version": "5.51.4", "description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue", "author": "Damian Osipiuk", "license": "MIT", diff --git a/packages/vue-query/src/index.ts b/packages/vue-query/src/index.ts index c3ea3e98e0..5ea6e26f83 100644 --- a/packages/vue-query/src/index.ts +++ b/packages/vue-query/src/index.ts @@ -24,6 +24,8 @@ export type { UseQueryOptions, UseQueryReturnType, UseQueryDefinedReturnType, + UndefinedInitialQueryOptions, + DefinedInitialQueryOptions, } from './useQuery' export type { UseInfiniteQueryOptions, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1033777c3e..1ff31f7cff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -151,7 +151,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(@angular/platform-browser@17.3.10(@angular/animations@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))) '@tanstack/angular-query-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -173,7 +173,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -197,7 +197,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(@angular/platform-browser@17.3.10(@angular/animations@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))) '@tanstack/angular-query-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -219,7 +219,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -246,7 +246,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(@angular/platform-browser@17.3.10(@angular/animations@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(rxjs@7.8.1) '@tanstack/angular-query-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -268,7 +268,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -295,7 +295,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(@angular/platform-browser@17.3.10(@angular/animations@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(@angular/common@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6))(rxjs@7.8.1))(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(rxjs@7.8.1) '@tanstack/angular-query-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -317,7 +317,7 @@ importers: specifier: ^17.3.10 version: 17.3.10(@angular/compiler@17.3.10(@angular/core@17.3.10(rxjs@7.8.1)(zone.js@0.14.6)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -332,10 +332,10 @@ importers: specifier: 4.23.3 version: 4.23.3 '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools algoliasearch: specifier: 4.23.3 @@ -369,10 +369,10 @@ importers: examples/react/auto-refetching: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -397,16 +397,16 @@ importers: examples/react/basic: dependencies: '@tanstack/query-sync-storage-persister': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/query-sync-storage-persister '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools '@tanstack/react-query-persist-client': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-persist-client react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -440,10 +440,10 @@ importers: examples/react/basic-graphql-request: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools graphql: specifier: ^16.8.1 @@ -468,10 +468,10 @@ importers: examples/react/default-query-function: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -493,10 +493,10 @@ importers: examples/react/infinite-query-with-max-pages: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -521,10 +521,10 @@ importers: examples/react/load-more-infinite-scroll: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -552,10 +552,10 @@ importers: examples/react/nextjs: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -580,10 +580,10 @@ importers: examples/react/nextjs-app-prefetching: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^15.0.0-rc.0 @@ -608,13 +608,13 @@ importers: examples/react/nextjs-suspense-streaming: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools '@tanstack/react-query-next-experimental': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-next-experimental next: specifier: ^14.2.4 @@ -636,19 +636,19 @@ importers: examples/react/offline: dependencies: '@tanstack/query-sync-storage-persister': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/query-sync-storage-persister '@tanstack/react-location': specifier: ^3.7.4 version: 3.7.4(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@19.0.0-rc-4c2e457c7c-20240522) '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools '@tanstack/react-query-persist-client': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-persist-client msw: specifier: ^2.3.0 @@ -676,10 +676,10 @@ importers: examples/react/optimistic-updates-cache: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -704,10 +704,10 @@ importers: examples/react/optimistic-updates-ui: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -732,10 +732,10 @@ importers: examples/react/pagination: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -760,10 +760,10 @@ importers: examples/react/playground: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -785,10 +785,10 @@ importers: examples/react/prefetching: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools next: specifier: ^14.2.4 @@ -822,10 +822,10 @@ importers: specifier: ^6.3.16 version: 6.3.16(yri22tnekttmcucjv33ecr33bu) '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools expo: specifier: ^51.0.8 @@ -874,10 +874,10 @@ importers: examples/react/react-router: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools localforage: specifier: ^1.10.0 @@ -938,10 +938,10 @@ importers: specifier: ^5.15.18 version: 5.15.18(react@19.0.0-rc-4c2e457c7c-20240522)(types-react@19.0.0-rc.1) '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -969,10 +969,10 @@ importers: examples/react/shadow-dom: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -1015,10 +1015,10 @@ importers: examples/react/simple: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -1052,10 +1052,10 @@ importers: specifier: ^5.15.18 version: 5.15.18(react@19.0.0-rc-4c2e457c7c-20240522)(types-react@19.0.0-rc.1) '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools react: specifier: 19.0.0-rc-4c2e457c7c-20240522 @@ -1083,10 +1083,10 @@ importers: examples/react/suspense: dependencies: '@tanstack/react-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query '@tanstack/react-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/react-query-devtools font-awesome: specifier: ^4.7.0 @@ -1129,10 +1129,10 @@ importers: specifier: ^7.6.0 version: 7.6.0(astro@4.9.1(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1)(typescript@5.3.3))(encoding@0.1.13)(next@14.2.4(@babel/core@7.24.6)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.71.1))(react@18.3.1) '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools astro: specifier: ^4.8.6 @@ -1150,10 +1150,10 @@ importers: examples/solid/basic: dependencies: '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools solid-js: specifier: ^1.8.17 @@ -1172,10 +1172,10 @@ importers: examples/solid/basic-graphql-request: dependencies: '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools graphql: specifier: ^16.8.1 @@ -1200,10 +1200,10 @@ importers: examples/solid/default-query-function: dependencies: '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools solid-js: specifier: ^1.8.17 @@ -1222,10 +1222,10 @@ importers: examples/solid/simple: dependencies: '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools solid-js: specifier: ^1.8.17 @@ -1256,10 +1256,10 @@ importers: specifier: ^1.0.0-rc.1 version: 1.0.0(@testing-library/jest-dom@6.4.6(vitest@2.0.3(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.29.1)))(rollup@4.14.1)(solid-js@1.8.17)(vinxi@0.3.11(@types/node@20.14.10)(idb-keyval@6.2.1)(ioredis@5.3.2)(less@4.2.0)(sass@1.71.1)(terser@5.29.1))(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1)) '@tanstack/solid-query': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query '@tanstack/solid-query-devtools': - specifier: ^5.51.2 + specifier: ^5.51.4 version: link:../../../packages/solid-query-devtools solid-js: specifier: ^1.8.17 @@ -1271,10 +1271,10 @@ importers: examples/svelte/auto-refetching: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1302,10 +1302,10 @@ importers: examples/svelte/basic: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1333,10 +1333,10 @@ importers: examples/svelte/load-more-infinite-scroll: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1364,10 +1364,10 @@ importers: examples/svelte/optimistic-updates-typescript: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1395,10 +1395,10 @@ importers: examples/svelte/playground: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1426,10 +1426,10 @@ importers: examples/svelte/simple: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/vite-plugin-svelte': @@ -1454,10 +1454,10 @@ importers: examples/svelte/ssr: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1485,10 +1485,10 @@ importers: examples/svelte/star-wars: dependencies: '@tanstack/svelte-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query '@tanstack/svelte-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/svelte-query-devtools devDependencies: '@sveltejs/adapter-auto': @@ -1562,10 +1562,10 @@ importers: examples/vue/basic: dependencies: '@tanstack/vue-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query '@tanstack/vue-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query-devtools vue: specifier: ^3.4.27 @@ -1584,7 +1584,7 @@ importers: examples/vue/dependent-queries: dependencies: '@tanstack/vue-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query vue: specifier: ^3.4.27 @@ -1603,16 +1603,16 @@ importers: examples/vue/persister: dependencies: '@tanstack/query-core': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/query-core '@tanstack/query-persist-client-core': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/query-persist-client-core '@tanstack/query-sync-storage-persister': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/query-sync-storage-persister '@tanstack/vue-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query idb-keyval: specifier: ^6.2.1 @@ -1634,10 +1634,10 @@ importers: examples/vue/simple: dependencies: '@tanstack/vue-query': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query '@tanstack/vue-query-devtools': - specifier: ^5.51.1 + specifier: ^5.51.4 version: link:../../../packages/vue-query-devtools vue: specifier: ^3.4.27