Skip to content

Commit

Permalink
Merge branch 'main' into feat/eslint-infinite-query-property-order
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo authored Sep 20, 2024
2 parents 9ffc697 + ca9e3c4 commit 6182304
Show file tree
Hide file tree
Showing 81 changed files with 516 additions and 264 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ View the contributing guidelines [here](/CONTRIBUTING.md)

### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)

<!-- Use the force, Luke -->
<!-- Use the force, Luke! -->
2 changes: 2 additions & 0 deletions docs/framework/react/guides/render-optimizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const useTodoCount = () => {

A component using the `useTodoCount` custom hook will only re-render if the length of the todos changes. It will **not** re-render if e.g. the name of a todo changed.

> Note: `select` operates on successfully cached data and is not the appropriate place to throw errors. The source of truth for errors is the `queryFn`, and a `select` function that returns an error results in `data` being `undefined` and `isSuccess` being `true`. We recommend handling errors in the `queryFn` if you wish to have a query fail on incorrect data, or outside of the query hook if you have a error case not related to caching.
### memoization

The `select` function will only re-run if:
Expand Down
6 changes: 2 additions & 4 deletions docs/framework/solid/reference/createQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function App() {
},
}))


return (
<div>
<Show when={todos.isError}>
Expand All @@ -94,11 +93,10 @@ function App() {
<div>
<div>Todos:</div>
<ul>
<For each={todos.data}>
{(todo) => <li>{todo.title}</li>}
</For>
<For each={todos.data}>{(todo) => <li>{todo.title}</li>}</For>
</ul>
</div>
</Show>
</div>
)
}
Expand Down
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.2",
"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.2",
"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.2",
"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.2",
"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.2",
"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.2",
"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.2",
"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.2",
"typescript": "5.3.3"
}
}
6 changes: 3 additions & 3 deletions examples/react/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
},
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.53.0",
"@tanstack/eslint-plugin-query": "^5.56.1",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.3.1",
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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
Expand Down
10 changes: 5 additions & 5 deletions examples/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"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.2",
"@tanstack/react-query": "^5.56.2",
"@tanstack/react-query-devtools": "^5.56.2",
"@tanstack/react-query-persist-client": "^5.56.2",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.53.0",
"@tanstack/eslint-plugin-query": "^5.56.1",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.3.1",
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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"@tanstack/react-query-next-experimental": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"@tanstack/react-query-persist-client": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"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.2",
"@tanstack/react-query-devtools": "^5.56.2",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"react-router": "^6.25.1",
Expand Down
Loading

0 comments on commit 6182304

Please sign in to comment.