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
@@ -64,9 +64,9 @@ However, we have not followed this concept through to all apis. For example, whe
64
64
65
65
To streamline all apis, we've decided to make all keys Arrays only:
66
66
67
-
```diff
68
-
- useQuery('todos', fetchTodos)
69
-
+ useQuery(['todos'], fetchTodos)
67
+
```tsx
68
+
-useQuery('todos', fetchTodos)// [!code --]
69
+
+useQuery(['todos'], fetchTodos)// [!code ++]
70
70
```
71
71
72
72
#### Codemod
@@ -104,10 +104,10 @@ With the introduction of the new [fetchStatus](../queries#fetchstatus) for bette
104
104
105
105
This will mostly affect `disabled` queries that don't have any `data` yet, as those were in `idle` state before:
106
106
107
-
```diff
108
-
- status: 'idle'
109
-
+ status: 'loading'
110
-
+ fetchStatus: 'idle'
107
+
```tsx
108
+
-status: 'idle'// [!code --]
109
+
+status: 'loading'// [!code ++]
110
+
+fetchStatus: 'idle'// [!code ++]
111
111
```
112
112
113
113
Also, have a look at [the guide on dependent queries](../dependent-queries)
@@ -116,9 +116,9 @@ Also, have a look at [the guide on dependent queries](../dependent-queries)
116
116
117
117
Due to this change, disabled queries (even temporarily disabled ones) will start in `loading` state. To make migration easier, especially for having a good flag to know when to display a loading spinner, you can check for `isInitialLoading` instead of `isLoading`:
118
118
119
-
```diff
120
-
- isLoading
121
-
+ isInitialLoading
119
+
```tsx
120
+
-isLoading// [!code --]
121
+
+isInitialLoading// [!code ++]
122
122
```
123
123
124
124
See also the guide on [disabling queries](../disabling-queries#isInitialLoading)
@@ -127,9 +127,9 @@ See also the guide on [disabling queries](../disabling-queries#isInitialLoading)
127
127
128
128
The `useQueries` hook now accepts an object with a `queries` prop as its input. The value of the `queries` prop is an array of queries (this array is identical to what was passed into `useQueries` in v3).
This flag defaults to `active` because `refetchActive` defaulted to `true`. This means we also need a way to tell `invalidateQueries` to not refetch at all, which is why a fourth option (`none`) is also allowed here.
@@ -276,14 +276,14 @@ The plugins `createWebStoragePersistor` and `createAsyncStoragePersistor` have b
276
276
277
277
Since these plugins are no longer experimental, their import paths have also been updated:
278
278
279
-
```diff
280
-
- import { persistQueryClient } from 'react-query/persistQueryClient-experimental'
281
-
- import { createWebStoragePersistor } from 'react-query/createWebStoragePersistor-experimental'
282
-
- import { createAsyncStoragePersistor } from 'react-query/createAsyncStoragePersistor-experimental'
### The `cancel` method on promises is no longer supported
@@ -302,13 +302,13 @@ As of v4, React Query is optimized for modern browsers. We have updated our brow
302
302
303
303
It was possible to change the logger globally by calling `setLogger`. In v4, that function is replaced with an optional field when creating a `QueryClient`.
304
304
305
-
```diff
306
-
- import { QueryClient, setLogger } from 'react-query';
307
-
+ import { QueryClient } from '@tanstack/react-query';
### No _default_ manual Garbage Collection server-side
@@ -334,13 +334,13 @@ Subscribing manually to the `QueryCache` has always given you a `QueryCacheNotif
334
334
335
335
#### QueryCacheNotifyEvent
336
336
337
-
```diff
338
-
- type: 'queryAdded'
339
-
+ type: 'added'
340
-
- type: 'queryRemoved'
341
-
+ type: 'removed'
342
-
- type: 'queryUpdated'
343
-
+ type: 'updated'
337
+
```tsx
338
+
-type: 'queryAdded'// [!code --]
339
+
+type: 'added'// [!code ++]
340
+
-type: 'queryRemoved'// [!code --]
341
+
+type: 'removed'// [!code ++]
342
+
-type: 'queryUpdated'// [!code --]
343
+
+type: 'updated'// [!code ++]
344
344
```
345
345
346
346
#### MutationCacheNotifyEvent
@@ -353,26 +353,26 @@ The `MutationCacheNotifyEvent` uses the same types as the `QueryCacheNotifyEvent
353
353
354
354
With version [3.22.0](https://github.com/tannerlinsley/react-query/releases/tag/v3.22.0), hydration utilities moved into the React Query core. With v3, you could still use the old exports from `react-query/hydration`, but these exports have been removed with v4.
355
355
356
-
```diff
357
-
- import { dehydrate, hydrate, useHydrate, Hydrate } from 'react-query/hydration'
358
-
+ import { dehydrate, hydrate, useHydrate, Hydrate } from '@tanstack/react-query'
### Removed undocumented methods from the `queryClient`, `query` and `mutation`
362
362
363
363
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`
Additionally, `query.setDefaultOptions` was removed because it was also unused. `mutation.cancel` was removed because it didn't actually cancel the outgoing request.
@@ -389,9 +389,9 @@ With the renamed directory this no longer is an issue.
389
389
390
390
If you were importing anything from `'react-query/react'` directly in your project (as opposed to just `'react-query'`), then you need to update your imports:
391
391
392
-
```diff
393
-
- import { QueryClientProvider } from 'react-query/react';
394
-
+ import { QueryClientProvider } from '@tanstack/react-query/reactjs';
0 commit comments