Skip to content

Commit

Permalink
Merge branch 'main' into feature/isSubscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo authored Jan 5, 2025
2 parents d85cddc + 3104854 commit 80490f1
Show file tree
Hide file tree
Showing 103 changed files with 1,551 additions and 1,478 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
with:
directory: packages
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: ${{ always() }}
run: npx nx-cloud stop-all-agents
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
with:
directory: packages
env:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.4.0
22.12.0
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you have been assigned to fix an issue or develop a new feature, please follo
pnpm install
```

- We use [pnpm](https://pnpm.io/) v8 for package management (run in case of pnpm-related issues).
- We use [pnpm](https://pnpm.io/) v9 for package management (run in case of pnpm-related issues).

```bash
corepack enable && corepack prepare
Expand Down
11 changes: 3 additions & 8 deletions docs/framework/angular/guides/invalidations-from-mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ replace: { 'useMutation': 'injectMutation', 'hook': 'function' }
[//]: # 'Example'

```ts
class TodoItemComponent {
mutation = injectMutation(() => ({
mutationFn: postTodo,
}))
}
mutation = injectMutation(() => ({
mutationFn: postTodo,
}))
```

[//]: # 'Example'
Expand All @@ -33,9 +31,6 @@ export class TodosComponent {
onSuccess: () => {
this.queryClient.invalidateQueries({ queryKey: ['todos'] })
this.queryClient.invalidateQueries({ queryKey: ['reminders'] })

// OR use the queryClient that is injected into the component
// this.queryClient.invalidateQueries({ queryKey: ['todos'] })
},
}))
}
Expand Down
27 changes: 27 additions & 0 deletions docs/framework/react/guides/migrating-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,33 @@ This last change is technically a breaking one, and was made so we don't prematu
+ </HydrationBoundary> // [!code ++]
```

### Query defaults changes

`queryClient.getQueryDefaults` will now merge together all matching registrations instead of returning only the first matching registration.

As a result, calls to `queryClient.setQueryDefaults` should now be ordered with _increasing_ specificity.
That is, registrations should be made from the **most generic key** to the **least generic one**.

For example:

```ts
+ queryClient.setQueryDefaults(['todo'], { // [!code ++]
+ retry: false, // [!code ++]
+ staleTime: 60_000, // [!code ++]
+ }) // [!code ++]
queryClient.setQueryDefaults(['todo', 'detail'], {
+ retry: true, // [!code --]
retryDelay: 1_000,
staleTime: 10_000,
})
- queryClient.setQueryDefaults(['todo'], { // [!code --]
- retry: false, // [!code --]
- staleTime: 60_000, // [!code --]
- }) // [!code --]
```

Note that in this specific example, `retry: true` was added to the `['todo', 'detail']` registration to counteract it now inheriting `retry: false` from the more general registration. The specific changes needed to maintain exact behavior will vary depending on your defaults.

[//]: # 'FrameworkSpecificBreakingChanges'

## New Features 🚀
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/react/reference/infiniteQueryOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ infiniteQueryOptions({

**Options**

You can generally pass everything to `queryOptions` that you can also pass to [`useInfiniteQuery`](../useInfiniteQuery). Some options will have no effect when then forwarded to a function like `queryClient.prefetchInfiniteQuery`, but TypeScript will still be fine with those excess properties.
You can generally pass everything to `infiniteQueryOptions` that you can also pass to [`useInfiniteQuery`](../useInfiniteQuery). Some options will have no effect when then forwarded to a function like `queryClient.prefetchInfiniteQuery`, but TypeScript will still be fine with those excess properties.

- `queryKey: QueryKey`
- **Required**
Expand Down
7 changes: 4 additions & 3 deletions docs/reference/QueryClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ The `getQueryDefaults` method returns the default options which have been set fo
const defaultOptions = queryClient.getQueryDefaults(['posts'])
```

> Note that if several query defaults match the given query key, the **first** matching one is returned.
> This could lead to unexpected behaviours. See [`setQueryDefaults`](#queryclientsetquerydefaults).
> Note that if several query defaults match the given query key, they will be merged together based on the order of registration.
> See [`setQueryDefaults`](#queryclientsetquerydefaults).
## `queryClient.setQueryDefaults`

Expand All @@ -543,7 +543,8 @@ function Component() {
- `options: QueryOptions`

> As stated in [`getQueryDefaults`](#queryclientgetquerydefaults), the order of registration of query defaults does matter.
> Since the **first** matching defaults are returned by `getQueryDefaults`, the registration should be made in the following order: from the **least generic key** to the **most generic one**. This way, in case of specific key, the first matching one would be the expected one.
> Since the matching defaults are merged by `getQueryDefaults`, the registration should be made in the following order: from the **most generic key** to the **least generic one** .
> This way, more specific defaults will override more generic defaults.
## `queryClient.getMutationDefaults`

Expand Down
2 changes: 1 addition & 1 deletion examples/angular/auto-refetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/angular/devtools-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@angular/router": "^19.1.0-next.0",
"@tanstack/angular-query-devtools-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-devtools-experimental": "^5.62.13",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/query-options-from-a-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@angular/router": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@angular/router": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/rxjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@angular/forms": "19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "^19.1.0-next.0",
"@angular/platform-browser": "^19.1.0-next.0",
"@angular/platform-browser-dynamic": "^19.1.0-next.0",
"@tanstack/angular-query-experimental": "^5.62.8",
"@tanstack/angular-query-experimental": "^5.62.13",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
"zone.js": "^0.15.0"
Expand Down
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.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.62.1",
"@tanstack/eslint-plugin-query": "^5.62.9",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.3.3",
Expand Down
6 changes: 3 additions & 3 deletions examples/react/auto-refetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^14.2.20",
"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.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"graphql": "^16.9.0",
"graphql-request": "^7.1.2",
"react": "^19.0.0",
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.62.8",
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query-persist-client": "^5.62.8",
"@tanstack/query-sync-storage-persister": "^5.62.12",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"@tanstack/react-query-persist-client": "^5.62.14",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.62.1",
"@tanstack/eslint-plugin-query": "^5.62.9",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vitejs/plugin-react": "^4.3.3",
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.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
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.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions examples/react/infinite-query-with-max-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^14.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
8 changes: 4 additions & 4 deletions examples/react/load-more-infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^14.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intersection-observer": "^9.13.1"
"react-intersection-observer": "^9.14.0"
},
"devDependencies": {
"@types/react": "^18.2.79",
Expand Down
10 changes: 5 additions & 5 deletions examples/react/nextjs-app-prefetching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^15.0.3",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"typescript": "5.7.2"
}
}
8 changes: 4 additions & 4 deletions examples/react/nextjs-suspense-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"test:types": "tsc"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query-next-experimental": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"@tanstack/react-query-next-experimental": "^5.62.14",
"next": "^14.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
6 changes: 3 additions & 3 deletions examples/react/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^14.2.20",
"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.62.8",
"@tanstack/query-sync-storage-persister": "^5.62.12",
"@tanstack/react-location": "^3.7.4",
"@tanstack/react-query": "^5.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"@tanstack/react-query-persist-client": "^5.62.8",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"@tanstack/react-query-persist-client": "^5.62.14",
"msw": "^2.6.6",
"react": "^19.0.0",
"react-dom": "^19.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/react/optimistic-updates-cache/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.62.8",
"@tanstack/react-query-devtools": "^5.62.8",
"next": "^14.2.18",
"@tanstack/react-query": "^5.62.14",
"@tanstack/react-query-devtools": "^5.62.14",
"next": "^14.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
Loading

0 comments on commit 80490f1

Please sign in to comment.