Skip to content

Commit 5ef3c8b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feature/angular-stable
2 parents a7e6aca + f536199 commit 5ef3c8b

File tree

281 files changed

+8284
-7718
lines changed

Some content is hidden

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

281 files changed

+8284
-7718
lines changed

.github/workflows/pr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ jobs:
7171
|--------|--------|
7272
| Main | [![](https://deno.bundlejs.com/badge?q=https://esm.sh/@tanstack/react-query/es2022/react-query.mjs&config={%22esbuild%22:{%22external%22:[%22react@^19.0.0/jsx-runtime?target=es2022%22,%22react@^19.0.0?target=es2022%22]}}&badge=detailed)](https://bundlejs.com/?q=https://esm.sh/@tanstack/react-query/es2022/react-query.mjs&config=%7B%22esbuild%22:%7B%22external%22:%5B%22react@%5E19.0.0/jsx-runtime?target=es2022%22,%22react@%5E19.0.0?target=es2022%22%5D%7D%7D) |
7373
| This PR | [![](https://deno.bundlejs.com/badge?q=https://esm.sh/pr/@tanstack/react-query@${{ env.COMMIT_SHA }}/es2022/react-query.mjs&config={%22esbuild%22:{%22external%22:[%22react@^19.0.0/jsx-runtime?target=es2022%22,%22react@^19.0.0?target=es2022%22]}}&badge=detailed)](https://bundlejs.com/?q=https://esm.sh/pr/@tanstack/react-query@${{ env.COMMIT_SHA }}/es2022/react-query.mjs&config=%7B%22esbuild%22:%7B%22external%22:%5B%22react@%5E19.0.0/jsx-runtime?target=es2022%22,%22react@%5E19.0.0?target=es2022%22%5D%7D%7D) |
74+
continue-on-error: true

CONTRIBUTING.md

+34-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pnpm i
100100
pnpm dev
101101
```
102102

103-
4. Now you can visit http://localhost:3000/query/latest/docs/overview in the browser and see the changes you make in `tanstack/query/docs` there.
103+
4. Now you can visit http://localhost:3000/query/latest/docs/framework/react/overview in the browser and see the changes you make in `tanstack/query/docs` there.
104104

105105
> [!WARNING]
106106
> You will need to update the `docs/config.json` file (in `TanStack/query`) if you add a new documentation page!
@@ -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/config.json

+201-2
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,143 @@
326326
}
327327
]
328328
},
329+
{
330+
"label": "solid",
331+
"children": [
332+
{
333+
"label": "Important Defaults",
334+
"to": "framework/solid/guides/important-defaults"
335+
},
336+
{
337+
"label": "Queries",
338+
"to": "framework/solid/guides/queries"
339+
},
340+
{
341+
"label": "Query Keys",
342+
"to": "framework/solid/guides/query-keys"
343+
},
344+
{
345+
"label": "Query Functions",
346+
"to": "framework/solid/guides/query-functions"
347+
},
348+
{
349+
"label": "Query Options",
350+
"to": "framework/solid/guides/query-options"
351+
},
352+
{
353+
"label": "Network Mode",
354+
"to": "framework/solid/guides/network-mode"
355+
},
356+
{
357+
"label": "Parallel Queries",
358+
"to": "framework/solid/guides/parallel-queries"
359+
},
360+
{
361+
"label": "Dependent Queries",
362+
"to": "framework/solid/guides/dependent-queries"
363+
},
364+
{
365+
"label": "Background Fetching Indicators",
366+
"to": "framework/solid/guides/background-fetching-indicators"
367+
},
368+
{
369+
"label": "Window Focus Refetching",
370+
"to": "framework/solid/guides/window-focus-refetching"
371+
},
372+
{
373+
"label": "Disabling/Pausing Queries",
374+
"to": "framework/solid/guides/disabling-queries"
375+
},
376+
{
377+
"label": "Query Retries",
378+
"to": "framework/solid/guides/query-retries"
379+
},
380+
{
381+
"label": "Paginated Queries",
382+
"to": "framework/solid/guides/paginated-queries"
383+
},
384+
{
385+
"label": "Infinite Queries",
386+
"to": "framework/solid/guides/infinite-queries"
387+
},
388+
{
389+
"label": "Initial Query Data",
390+
"to": "framework/solid/guides/initial-query-data"
391+
},
392+
{
393+
"label": "Placeholder Query Data",
394+
"to": "framework/solid/guides/placeholder-query-data"
395+
},
396+
{
397+
"label": "Mutations",
398+
"to": "framework/solid/guides/mutations"
399+
},
400+
{
401+
"label": "Query Invalidation",
402+
"to": "framework/solid/guides/query-invalidation"
403+
},
404+
{
405+
"label": "Invalidation from Mutations",
406+
"to": "framework/solid/guides/invalidations-from-mutations"
407+
},
408+
{
409+
"label": "Updates from Mutation Responses",
410+
"to": "framework/solid/guides/updates-from-mutation-responses"
411+
},
412+
{
413+
"label": "Optimistic Updates",
414+
"to": "framework/solid/guides/optimistic-updates"
415+
},
416+
{
417+
"label": "Query Cancellation",
418+
"to": "framework/solid/guides/query-cancellation"
419+
},
420+
{
421+
"label": "Scroll Restoration",
422+
"to": "framework/solid/guides/scroll-restoration"
423+
},
424+
{
425+
"label": "Filters",
426+
"to": "framework/solid/guides/filters"
427+
},
428+
{
429+
"label": "Request Waterfalls",
430+
"to": "framework/solid/guides/request-waterfalls"
431+
},
432+
{
433+
"label": "Prefetching",
434+
"to": "framework/solid/guides/prefetching"
435+
},
436+
{
437+
"label": "SSR",
438+
"to": "framework/solid/guides/ssr"
439+
},
440+
{
441+
"label": "Advanced SSR",
442+
"to": "framework/solid/guides/advanced-ssr"
443+
},
444+
{
445+
"label": "Caching",
446+
"to": "framework/solid/guides/caching"
447+
},
448+
{
449+
"label": "Default Query Fn",
450+
"to": "framework/solid/guides/default-query-function"
451+
},
452+
{
453+
"label": "Suspense",
454+
"to": "framework/solid/guides/suspense"
455+
},
456+
{
457+
"label": "Testing",
458+
"to": "framework/solid/guides/testing"
459+
},
460+
{
461+
"label": "Does this replace state managers?",
462+
"to": "framework/angular/guides/does-this-replace-client-state"
463+
}
464+
]
465+
},
329466
{
330467
"label": "vue",
331468
"children": [
@@ -757,8 +894,44 @@
757894
"label": "solid",
758895
"children": [
759896
{
760-
"label": "createQuery",
761-
"to": "framework/solid/reference/createQuery"
897+
"label": "useQuery",
898+
"to": "framework/solid/reference/useQuery"
899+
},
900+
{
901+
"label": "useQueries",
902+
"to": "framework/solid/reference/useQueries"
903+
},
904+
{
905+
"label": "useInfiniteQuery",
906+
"to": "framework/solid/reference/useInfiniteQuery"
907+
},
908+
{
909+
"label": "useMutation",
910+
"to": "framework/solid/reference/useMutation"
911+
},
912+
{
913+
"label": "useIsFetching",
914+
"to": "framework/solid/reference/useIsFetching"
915+
},
916+
{
917+
"label": "useIsMutating",
918+
"to": "framework/solid/reference/useIsMutating"
919+
},
920+
{
921+
"label": "useMutationState",
922+
"to": "framework/solid/reference/useMutationState"
923+
},
924+
{
925+
"label": "queryOptions",
926+
"to": "framework/solid/reference/queryOptions"
927+
},
928+
{
929+
"label": "infiniteQueryOptions",
930+
"to": "framework/solid/reference/infiniteQueryOptions"
931+
},
932+
{
933+
"label": "hydration",
934+
"to": "framework/solid/reference/hydration"
762935
}
763936
]
764937
},
@@ -844,6 +1017,19 @@
8441017
}
8451018
]
8461019
},
1020+
{
1021+
"label": "solid",
1022+
"children": [
1023+
{
1024+
"label": "TkDodo's Blog",
1025+
"to": "framework/solid/community/tkdodos-blog"
1026+
},
1027+
{
1028+
"label": "Community Projects",
1029+
"to": "framework/solid/community/community-projects"
1030+
}
1031+
]
1032+
},
8471033
{
8481034
"label": "vue",
8491035
"children": [
@@ -1131,6 +1317,19 @@
11311317
}
11321318
]
11331319
},
1320+
{
1321+
"label": "solid",
1322+
"children": [
1323+
{
1324+
"label": "broadcastQueryClient (Experimental)",
1325+
"to": "framework/solid/plugins/broadcastQueryClient"
1326+
},
1327+
{
1328+
"label": "createPersister (Experimental)",
1329+
"to": "framework/solid/plugins/createPersister"
1330+
}
1331+
]
1332+
},
11341333
{
11351334
"label": "vue",
11361335
"children": [

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/community/community-projects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Link: https://the-guild.dev/graphql/codegen
3939

4040
## Http-wizard
4141

42-
End-to-end type-safe Fastify API with typecript magic ✨
42+
End-to-end type-safe Fastify API with typeScript magic ✨
4343

4444
Link: https://http-wizard.com
4545

docs/framework/react/guides/migrating-to-react-query-4.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ With version [3.22.0](https://github.com/tannerlinsley/react-query/releases/tag/
368368
369369
### Removed undocumented methods from the `queryClient`, `query` and `mutation`
370370
371-
The methods `cancelMutatations` and `executeMutation` on the `QueryClient` were undocumented and unused internally, so we removed them. Since it was just a wrapper around a method available on the `mutationCache`, you can still use the functionality of `executeMutation`
371+
The methods `cancelMutations` and `executeMutation` on the `QueryClient` were undocumented and unused internally, so we removed them. Since it was just a wrapper around a method available on the `mutationCache`, you can still use the functionality of `executeMutation`
372372
373373
```tsx
374374
- executeMutation< // [!code --]

docs/framework/react/guides/migrating-to-v5.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ v5 is a major version, so there are some breaking changes to be aware of:
99

1010
### Supports a single signature, one object
1111

12-
useQuery and friends used to have many overloads in TypeScript - different ways how the function can be invoked. Not only this was tough to maintain, type wise, it also required a runtime check to see which type the first and the second parameter, to correctly create options.
12+
useQuery and friends used to have many overloads in TypeScript: different ways how the function could be invoked. Not only was this tough to maintain, type wise, it also required a runtime check to see which types the first and the second parameter were, to correctly create options.
1313

1414
now we only support the object format.
1515

docs/framework/react/guides/query-cancellation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,4 @@ return (
190190

191191
## Limitations
192192

193-
Cancelation does not work when working with `Suspense` hooks: `useSuspenseQuery`, `useSuspenseQueries` and `useSuspenseInfiniteQuery`.
193+
Cancellation does not work when working with `Suspense` hooks: `useSuspenseQuery`, `useSuspenseQueries` and `useSuspenseInfiniteQuery`.

0 commit comments

Comments
 (0)