Skip to content

Commit

Permalink
Merge branch 'main' into fix-8046
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo authored Sep 12, 2024
2 parents 03fa7e1 + d29c37a commit 1784c7a
Show file tree
Hide file tree
Showing 74 changed files with 385 additions and 231 deletions.
26 changes: 26 additions & 0 deletions docs/reference/QueryClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Its available methods are:
- [`queryClient.prefetchInfiniteQuery`](#queryclientprefetchinfinitequery)
- [`queryClient.getQueryData`](#queryclientgetquerydata)
- [`queryClient.ensureQueryData`](#queryclientensurequerydata)
- [`queryClient.ensureInfiniteQueryData`](#queryclientensureinfinitequerydata)
- [`queryClient.getQueriesData`](#queryclientgetqueriesdata)
- [`queryClient.setQueryData`](#queryclientsetquerydata)
- [`queryClient.getQueryState`](#queryclientgetquerystate)
Expand Down Expand Up @@ -200,6 +201,31 @@ const data = await queryClient.ensureQueryData({ queryKey, queryFn })

- `Promise<TData>`

## `queryClient.ensureInfiniteQueryData`

`ensureInfiniteQueryData` is an asynchronous function that can be used to get an existing infinite query's cached data. If the query does not exist, `queryClient.fetchInfiniteQuery` will be called and its results returned.

```tsx
const data = await queryClient.ensureInfiniteQueryData({
queryKey,
queryFn,
initialPageParam,
getNextPageParam,
})
```

**Options**

- the same options as [`fetchInfiniteQuery`](#queryclientfetchinfinitequery)
- `revalidateIfStale: boolean`
- Optional
- Defaults to `false`
- If set to `true`, stale data will be refetched in the background, but cached data will be returned immediately.

**Returns**

- `Promise<InfiniteData<TData, TPageParam>>`

## `queryClient.getQueriesData`

`getQueriesData` is a synchronous function that can be used to get the cached data of multiple queries. Only queries that match the passed queryKey or queryFilter will be returned. If there are no matching queries, an empty array will be returned.
Expand Down
4 changes: 2 additions & 2 deletions examples/angular/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.55.4",
"@tanstack/angular-query-experimental": "^5.56.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
Expand All @@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.55.4",
"@tanstack/angular-query-devtools-experimental": "^5.56.0",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.55.4",
"@tanstack/angular-query-experimental": "^5.56.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
Expand All @@ -23,7 +23,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.55.4",
"@tanstack/angular-query-devtools-experimental": "^5.56.0",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@angular/router": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.55.4",
"@tanstack/angular-query-experimental": "^5.56.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
Expand All @@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.55.4",
"@tanstack/angular-query-devtools-experimental": "^5.56.0",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/angular/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@angular/router": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.55.4",
"@tanstack/angular-query-experimental": "^5.56.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.14.8"
Expand All @@ -24,7 +24,7 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.55.4",
"@tanstack/angular-query-devtools-experimental": "^5.56.0",
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@algolia/client-search": "5.2.1",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/auto-refetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/basic-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
Expand Down
8 changes: 4 additions & 4 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.55.4",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query-persist-client": "^5.55.4",
"@tanstack/query-sync-storage-persister": "^5.56.0",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"@tanstack/react-query-persist-client": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/default-query-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/devtools-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/load-more-infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/nextjs-app-prefetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^15.0.0-rc.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
Expand Down
6 changes: 3 additions & 3 deletions examples/react/nextjs-suspense-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query-next-experimental": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"@tanstack/react-query-next-experimental": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
8 changes: 4 additions & 4 deletions examples/react/offline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/query-sync-storage-persister": "^5.55.4",
"@tanstack/query-sync-storage-persister": "^5.56.0",
"@tanstack/react-location": "^3.7.4",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query-persist-client": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"@tanstack/react-query-persist-client": "^5.56.0",
"msw": "^2.3.4",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/optimistic-updates-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/prefetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"next": "^14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/react/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@react-native-community/netinfo": "^11.3.2",
"@react-navigation/native": "^6.1.18",
"@react-navigation/stack": "^6.4.1",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"expo": "^51.0.22",
"expo-constants": "^16.0.2",
"expo-status-bar": "^1.12.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"react": "19.0.0-rc-4c2e457c7c-20240522",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/rick-morty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@emotion/styled": "^11.13.0",
"@mui/material": "^6.0.0",
"@mui/styles": "^6.0.0",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.25.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/shadow-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/react/star-wars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@emotion/styled": "^11.13.0",
"@mui/material": "^6.0.0",
"@mui/styles": "^6.0.0",
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.25.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.55.4",
"@tanstack/react-query-devtools": "^5.55.4",
"@tanstack/react-query": "^5.56.0",
"@tanstack/react-query-devtools": "^5.56.0",
"font-awesome": "^4.7.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
Expand Down
4 changes: 2 additions & 2 deletions examples/solid/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@astrojs/solid-js": "^4.4.0",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/vercel": "^7.7.2",
"@tanstack/solid-query": "^5.55.4",
"@tanstack/solid-query-devtools": "^5.55.4",
"@tanstack/solid-query": "^5.56.0",
"@tanstack/solid-query-devtools": "^5.56.0",
"astro": "^4.12.2",
"solid-js": "^1.8.19",
"tailwindcss": "^3.4.7",
Expand Down
Loading

0 comments on commit 1784c7a

Please sign in to comment.