Skip to content

Commit 59dde5c

Browse files
authored
Merge branch 'main' into query-core/test/use-fake-timers-infiniteQueryBehavior.test.tsx
2 parents 9bb648b + 812fadf commit 59dde5c

File tree

163 files changed

+1638
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1638
-363
lines changed

CONTRIBUTING.md

+33
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,36 @@ Use an appropriate commit type. Be especially careful with breaking changes.
236236
## Releases
237237

238238
For each new commit added to `main` with `git push` or by merging a pull request or merging from another branch, a GitHub action is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
239+
240+
## 🧪 Test
241+
242+
TanStack Query uses [Nx](https://nx.dev/) as its monorepo tool.
243+
To run tests in a local environment, you should use `nx` commands from the root directory.
244+
245+
### ✅ Run all tests
246+
247+
To run tests for **all packages**, run:
248+
249+
```bash
250+
npm run test
251+
```
252+
253+
### ✅ Run tests for a specific package
254+
255+
To run tests for a specific package, use the following command:
256+
257+
```bash
258+
npx nx run @tanstack/{package-name}:test:lib
259+
```
260+
261+
For example:
262+
263+
```bash
264+
npx nx run @tanstack/react-query:test:lib
265+
```
266+
267+
### ⚠️ Caution
268+
269+
Do not run `pnpm run test:lib` inside individual package folders.
270+
This can cause test failures due to dependencies between packages.
271+
Always run tests from the **root folder** using `nx` commands.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ View the contributing guidelines [here](/CONTRIBUTING.md)
5151

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

54-
<!-- Use the force, Luke! -->
54+
<!-- Use the force, Luke -->

docs/eslint/eslint-plugin-query.md

+1
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ Alternatively, add `@tanstack/query` to the plugins section, and configure the r
9898
- [@tanstack/query/stable-query-client](./stable-query-client.md)
9999
- [@tanstack/query/no-unstable-deps](./no-unstable-deps.md)
100100
- [@tanstack/query/infinite-query-property-order](./infinite-query-property-order.md)
101+
- [@tanstack/query/no-void-query-fn](./no-void-query-fn.md)

docs/eslint/no-void-query-fn.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
id: no-void-query-fn
3+
title: Disallow returning void from query functions
4+
---
5+
6+
Query functions must return a value that will be cached by TanStack Query. Functions that don't return a value (void functions) can lead to unexpected behavior and might indicate a mistake in the implementation.
7+
8+
## Rule Details
9+
10+
Example of **incorrect** code for this rule:
11+
12+
```tsx
13+
/* eslint "@tanstack/query/no-void-query-fn": "error" */
14+
15+
useQuery({
16+
queryKey: ['todos'],
17+
queryFn: async () => {
18+
await api.todos.fetch() // Function doesn't return the fetched data
19+
},
20+
})
21+
```
22+
23+
Example of **correct** code for this rule:
24+
25+
```tsx
26+
/* eslint "@tanstack/query/no-void-query-fn": "error" */
27+
useQuery({
28+
queryKey: ['todos'],
29+
queryFn: async () => {
30+
const todos = await api.todos.fetch()
31+
return todos
32+
},
33+
})
34+
```
35+
36+
## Attributes
37+
38+
- [x] ✅ Recommended
39+
- [ ] 🔧 Fixable

docs/framework/react/reference/useQuery.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const {
7575
- `enabled: boolean | (query: Query) => boolean`
7676
- Set this to `false` to disable this query from automatically running.
7777
- Can be used for [Dependent Queries](../guides/dependent-queries.md).
78-
- `networkMode: 'online' | 'always' | 'offlineFirst`
78+
- `networkMode: 'online' | 'always' | 'offlineFirst'`
7979
- optional
8080
- defaults to `'online'`
8181
- see [Network Mode](../guides/network-mode.md) for more information.

examples/angular/auto-refetching/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@angular/core": "^19.2.4",
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
17-
"@tanstack/angular-query-experimental": "^5.71.10",
17+
"@tanstack/angular-query-experimental": "^5.72.3",
1818
"rxjs": "^7.8.2",
1919
"tslib": "^2.8.1",
2020
"zone.js": "0.15.0"

examples/angular/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@angular/core": "^19.2.4",
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
17-
"@tanstack/angular-query-experimental": "^5.71.10",
17+
"@tanstack/angular-query-experimental": "^5.72.3",
1818
"rxjs": "^7.8.2",
1919
"tslib": "^2.8.1",
2020
"zone.js": "0.15.0"

examples/angular/devtools-panel/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
1717
"@angular/router": "^19.2.4",
18-
"@tanstack/angular-query-devtools-experimental": "^5.71.10",
19-
"@tanstack/angular-query-experimental": "^5.71.10",
18+
"@tanstack/angular-query-devtools-experimental": "^5.72.3",
19+
"@tanstack/angular-query-experimental": "^5.72.3",
2020
"rxjs": "^7.8.2",
2121
"tslib": "^2.8.1",
2222
"zone.js": "0.15.0"

examples/angular/devtools-panel/src/app/components/lazy-load-devtools-panel-example.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export default class LazyLoadDevtoolsPanelExampleComponent {
5151
this.devtools.set(
5252
import('@tanstack/angular-query-devtools-experimental').then(
5353
({ injectDevtoolsPanel }) =>
54-
injectDevtoolsPanel(this.devToolsOptions, this.injector),
54+
injectDevtoolsPanel(this.devToolsOptions, {
55+
injector: this.injector,
56+
}),
5557
),
5658
)
5759
}

examples/angular/infinite-query-with-max-pages/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@angular/core": "^19.2.4",
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
17-
"@tanstack/angular-query-experimental": "^5.71.10",
17+
"@tanstack/angular-query-experimental": "^5.72.3",
1818
"rxjs": "^7.8.2",
1919
"tslib": "^2.8.1",
2020
"zone.js": "0.15.0"

examples/angular/optimistic-updates/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/forms": "^19.2.4",
1616
"@angular/platform-browser": "^19.2.4",
1717
"@angular/platform-browser-dynamic": "^19.2.4",
18-
"@tanstack/angular-query-experimental": "^5.71.10",
18+
"@tanstack/angular-query-experimental": "^5.72.3",
1919
"rxjs": "^7.8.2",
2020
"tslib": "^2.8.1",
2121
"zone.js": "0.15.0"

examples/angular/pagination/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@angular/core": "^19.2.4",
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
17-
"@tanstack/angular-query-experimental": "^5.71.10",
17+
"@tanstack/angular-query-experimental": "^5.72.3",
1818
"rxjs": "^7.8.2",
1919
"tslib": "^2.8.1",
2020
"zone.js": "0.15.0"

examples/angular/query-options-from-a-service/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
1717
"@angular/router": "^19.2.4",
18-
"@tanstack/angular-query-experimental": "^5.71.10",
18+
"@tanstack/angular-query-experimental": "^5.72.3",
1919
"rxjs": "^7.8.2",
2020
"tslib": "^2.8.1",
2121
"zone.js": "0.15.0"

examples/angular/router/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
1717
"@angular/router": "^19.2.4",
18-
"@tanstack/angular-query-experimental": "^5.71.10",
18+
"@tanstack/angular-query-experimental": "^5.72.3",
1919
"rxjs": "^7.8.2",
2020
"tslib": "^2.8.1",
2121
"zone.js": "0.15.0"

examples/angular/rxjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/forms": "^19.2.4",
1616
"@angular/platform-browser": "^19.2.4",
1717
"@angular/platform-browser-dynamic": "^19.2.4",
18-
"@tanstack/angular-query-experimental": "^5.71.10",
18+
"@tanstack/angular-query-experimental": "^5.72.3",
1919
"rxjs": "^7.8.2",
2020
"tslib": "^2.8.1",
2121
"zone.js": "0.15.0"

examples/angular/simple/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@angular/core": "^19.2.4",
1515
"@angular/platform-browser": "^19.2.4",
1616
"@angular/platform-browser-dynamic": "^19.2.4",
17-
"@tanstack/angular-query-experimental": "^5.71.10",
17+
"@tanstack/angular-query-experimental": "^5.72.3",
1818
"rxjs": "^7.8.2",
1919
"tslib": "^2.8.1",
2020
"zone.js": "0.15.0"

examples/react/algolia/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
},
1010
"dependencies": {
1111
"@algolia/client-search": "5.2.1",
12-
"@tanstack/react-query": "^5.71.10",
13-
"@tanstack/react-query-devtools": "^5.71.10",
12+
"@tanstack/react-query": "^5.72.2",
13+
"@tanstack/react-query-devtools": "^5.72.2",
1414
"react": "^19.0.0",
1515
"react-dom": "^19.0.0"
1616
},
1717
"devDependencies": {
18-
"@tanstack/eslint-plugin-query": "^5.71.5",
18+
"@tanstack/eslint-plugin-query": "^5.72.2",
1919
"@types/react": "^18.2.79",
2020
"@types/react-dom": "^18.2.25",
2121
"@vitejs/plugin-react": "^4.3.4",

examples/react/auto-refetching/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"start": "next start"
99
},
1010
"dependencies": {
11-
"@tanstack/react-query": "^5.71.10",
12-
"@tanstack/react-query-devtools": "^5.71.10",
11+
"@tanstack/react-query": "^5.72.2",
12+
"@tanstack/react-query-devtools": "^5.72.2",
1313
"next": "^15.0.0",
1414
"react": "^18.2.0",
1515
"react-dom": "^18.2.0"

examples/react/basic-graphql-request/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"@tanstack/react-query": "^5.71.10",
12-
"@tanstack/react-query-devtools": "^5.71.10",
11+
"@tanstack/react-query": "^5.72.2",
12+
"@tanstack/react-query-devtools": "^5.72.2",
1313
"graphql": "^16.9.0",
1414
"graphql-request": "^7.1.2",
1515
"react": "^19.0.0",

examples/react/basic/package.json

+16-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,32 @@
55
"scripts": {
66
"dev": "vite",
77
"build": "vite build",
8-
"preview": "vite preview"
8+
"preview": "vite preview",
9+
"test:eslint": "eslint ./src"
910
},
1011
"dependencies": {
11-
"@tanstack/query-sync-storage-persister": "^5.71.10",
12-
"@tanstack/react-query": "^5.71.10",
13-
"@tanstack/react-query-devtools": "^5.71.10",
14-
"@tanstack/react-query-persist-client": "^5.71.10",
12+
"@tanstack/query-sync-storage-persister": "^5.72.2",
13+
"@tanstack/react-query": "^5.72.2",
14+
"@tanstack/react-query-devtools": "^5.72.2",
15+
"@tanstack/react-query-persist-client": "^5.72.2",
1516
"react": "^19.0.0",
1617
"react-dom": "^19.0.0"
1718
},
1819
"devDependencies": {
19-
"@tanstack/eslint-plugin-query": "^5.71.5",
20+
"@tanstack/eslint-plugin-query": "^5.72.2",
2021
"@types/react": "^18.2.79",
2122
"@types/react-dom": "^18.2.25",
2223
"@vitejs/plugin-react": "^4.3.4",
2324
"typescript": "5.8.2",
2425
"vite": "^6.2.4"
26+
},
27+
"nx": {
28+
"targets": {
29+
"test:eslint": {
30+
"dependsOn": [
31+
"^build"
32+
]
33+
}
34+
}
2535
}
2636
}

examples/react/chat/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"@tanstack/react-query": "^5.71.10",
12-
"@tanstack/react-query-devtools": "^5.71.10",
11+
"@tanstack/react-query": "^5.72.2",
12+
"@tanstack/react-query-devtools": "^5.72.2",
1313
"react": "^19.0.0",
1414
"react-dom": "^19.0.0"
1515
},

examples/react/default-query-function/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"@tanstack/react-query": "^5.71.10",
12-
"@tanstack/react-query-devtools": "^5.71.10",
11+
"@tanstack/react-query": "^5.72.2",
12+
"@tanstack/react-query-devtools": "^5.72.2",
1313
"react": "^19.0.0",
1414
"react-dom": "^19.0.0"
1515
},

examples/react/devtools-panel/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"@tanstack/react-query": "^5.71.10",
12-
"@tanstack/react-query-devtools": "^5.71.10",
11+
"@tanstack/react-query": "^5.72.2",
12+
"@tanstack/react-query-devtools": "^5.72.2",
1313
"react": "^19.0.0",
1414
"react-dom": "^19.0.0"
1515
},
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["plugin:@tanstack/query/recommended"]
3+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
pnpm-lock.yaml
15+
yarn.lock
16+
package-lock.json
17+
18+
# misc
19+
.DS_Store
20+
.env.local
21+
.env.development.local
22+
.env.test.local
23+
.env.production.local
24+
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Example
2+
3+
To run this example:
4+
5+
- `npm install`
6+
- `npm run dev`
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" type="image/svg+xml" href="/emblem-light.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
9+
<title>TanStack Query React Basic Example App</title>
10+
</head>
11+
<body>
12+
<noscript>You need to enable JavaScript to run this app.</noscript>
13+
<div id="root"></div>
14+
<script type="module" src="/src/index.tsx"></script>
15+
</body>
16+
</html>
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@tanstack/query-example-eslint-legacy",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview",
9+
"test:eslint": "eslint ./src"
10+
},
11+
"dependencies": {
12+
"@tanstack/query-sync-storage-persister": "^5.72.2",
13+
"@tanstack/react-query": "^5.72.2",
14+
"@tanstack/react-query-devtools": "^5.72.2",
15+
"@tanstack/react-query-persist-client": "^5.72.2",
16+
"react": "^19.0.0",
17+
"react-dom": "^19.0.0"
18+
},
19+
"devDependencies": {
20+
"@tanstack/eslint-plugin-query": "^5.72.2",
21+
"eslint": "^8.16.0",
22+
"@types/react": "^18.2.79",
23+
"@types/react-dom": "^18.2.25",
24+
"@vitejs/plugin-react": "^4.3.4",
25+
"typescript": "5.8.2",
26+
"vite": "^6.2.4"
27+
}
28+
}

0 commit comments

Comments
 (0)