You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor(query-core): remove overloads
remove overloads and only allow all functions to be called with a single signature
BREAKING CHANGE: Overloads are removed, query-core now supports a single signature
* test(query-core): apply single signature to all tests
* refactor(react-query): remove overloads
remove overloads and only allow all functions to be called with a single signature
BREAKING CHANGE: Overloads are removed, react-query now supports a single signature
* test(react-query): apply single signature to all tests
* refactor(solid-query): remove overloads
remove overloads and only allow all functions to be called with a single signature
BREAKING CHANGE: Overloads are removed, solid-query now supports a single signature
* test(solid-query): apply single signature to all tests
* refactor(vue-query): remove overloads
remove overloads and only allow all functions to be called with a single signature
BREAKING CHANGE: Overloads are removed, vue-query now supports a single signature
* test(vue-query): apply single signature to all tests
* test(react-query-persist-client): apply single signature to all tests
* fix(react-query-devtools): apply single signature to all tests
* test(react-query-devtools): apply single signature to all tests
* test(query-sync-storage-persister): apply single signature to all tests
* docs: apply object single signature to all docs
* docs(examples/react): apply object single signature to all examples
* docs(examples/solid): apply object single signature to all examples
* docs(examples/vue): apply object single signature to all examples
* style(examples): run prettier on all files
* docs: use multiline whenever we use the object syntax
* fix(setQueryDefaults): keep it as two arguments
* fix(createMutation): remove unnecessary shallow copy
* fix(vue-query): rename parseArgs functions to unrefArgs
* docs(migrating-to-react-query-5): list all affected functions
* fix(setQueryData): remove as alias
* refactor(getQueryData): getQueryData now supports only queryKey as an argument
BREAKING CHANGE: getQueryData now accepts only queryKey as an argument
* refactor(getQueryState): getQueryState now supports only queryKey as an argument
BREAKING CHANGE: getQueryState now accepts only queryKey as an argument
* test(react-query/useQuery): missing single signature
Copy file name to clipboardExpand all lines: docs/react/guides/migrating-to-react-query-5.md
+90Lines changed: 90 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,96 @@ title: Migrating to TanStack Query v5
7
7
8
8
v5 is a major version, so there are some breaking changes to be aware of:
9
9
10
+
### Supports a single signature, one object
11
+
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.
### `queryClient.getQueryData` now accepts queryKey only as an Argument
83
+
84
+
`queryClient.getQueryData` argument is changed to accept only a `queryKey`
85
+
86
+
```diff
87
+
- queryClient.getQueryData(queryKey, filters)
88
+
+ queryClient.getQueryData(queryKey)
89
+
```
90
+
91
+
### `queryClient.getQueryState` now accepts queryKey only as an Argument
92
+
93
+
`queryClient.getQueryState` argument is changed to accept only a `queryKey`
94
+
95
+
```diff
96
+
- queryClient.getQueryState(queryKey, filters)
97
+
+ queryClient.getQueryState(queryKey)
98
+
```
99
+
10
100
### The `remove` method has been removed from useQuery
11
101
12
102
Previously, remove method used to remove the query from the queryCache without informing observers about it. It was best used to remove data imperatively that is no longer needed, e.g. when logging a user out.
@@ -263,13 +263,13 @@ Updates via `setQueryData` must be performed in an _immuatable_ way. **DO NOT**
263
263
`getQueryState` is a synchronous function that can be used to get an existing query's state. If the query does not exist, `undefined` will be returned.
264
264
265
265
```tsx
266
-
const state =queryClient.getQueryState({ queryKey })
0 commit comments