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
Copy file name to clipboardExpand all lines: docs/src/pages/devtools.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ import { ReactQueryDevtools } from 'react-query/devtools'
18
18
```
19
19
20
20
By default, React Query Devtools are only included in bundles when `process.env.NODE_ENV === 'development'`, so you don't need to worry about excluding them during a production build.
21
+
21
22
## Floating Mode
22
23
23
24
Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
Copy file name to clipboardExpand all lines: docs/src/pages/guides/migrating-to-react-query-4.md
+102-1Lines changed: 102 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,7 +282,7 @@ It was possible to change the logger globally by calling `setLogger`. In v4, tha
282
282
+ const queryClient = new QueryClient({ logger: customLogger })
283
283
```
284
284
285
-
### Undefined is an illegale cache value for successful queries
285
+
### Undefined is an illegal cache value for successful queries
286
286
287
287
In order to make bailing out of updates possible by returning `undefined`, we had to make `undefined` an illegal cache value. This is in-line with other concepts of react-query, for example, returning `undefined` from the [initialData function](guides/initial-query-data#initial-data-function) will also _not_ set data.
288
288
@@ -301,6 +301,20 @@ This is now disallowed on type level; at runtime, `undefined` will be transforme
301
301
302
302
As of v4, React Query is optimized for modern browsers. We have updated our browserslist to produce a more modern, performant and smaller bundle. You can read about the requirements [here](../installation#requirements).
303
303
304
+
### The idle state has been removed
305
+
306
+
With the introduction of the new [fetchStatus](../guides/queries#fetchstatus) for better offline support, the `idle` state became irrelevant, because `fetchStatus: 'idle'` captures the same state better. For more information, please read [Why two different states](../guides/queries#why-two-different-states).
307
+
308
+
This will mostly affect `disabled` queries that don't have any `data` yet, as those were in `idle` state before:
309
+
310
+
```diff
311
+
- status: 'idle'
312
+
+ status: 'loading'
313
+
+ fetchStatus: 'idle'
314
+
```
315
+
316
+
Also, have a look at [the guide on dependent queries](../guides/dependent-queries)
317
+
304
318
## New Features 🚀
305
319
306
320
### Proper offline support
@@ -332,3 +346,90 @@ When using the [functional updater form of setQueryData](../reference/QueryClien
Custom contexts can now be specified to pair hooks with their matching `Provider`. This is critical when there may be multiple React Query `Provider` instances in the component tree and you need to ensure your hook uses the correct `Provider` instance.
353
+
354
+
An example:
355
+
356
+
1) Create a data package.
357
+
358
+
```tsx
359
+
// Our first data package: @my-scope/container-data
- Set this to `true` to enable context sharing, which will share the first and at least one instance of the context across the window to ensure that if React Query is used across different bundles or microfrontends they will all use the same **instance** of context, regardless of module scoping.
25
+
- Set this to `true` to enable context sharing, which will share the first and at least one instance of the context across the window to ensure that if React Query is used across different bundles or microfrontends they will all use the same **instance** of context, regardless of module scoping.
Copy file name to clipboardExpand all lines: docs/src/pages/reference/useMutation.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,8 @@ mutate(variables, {
87
87
-`meta: Record<string, unknown>`
88
88
- Optional
89
89
- If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever the `mutation` is available (eg. `onError`, `onSuccess` functions of the `MutationCache`).
Copy file name to clipboardExpand all lines: docs/src/pages/reference/useQueries.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,10 @@ const results = useQueries({
16
16
17
17
**Options**
18
18
19
-
The `useQueries` hook accepts an options object with a **queries** key whose value is an array with query option objects identical to the [`useQuery` hook](/reference/useQuery).
19
+
The `useQueries` hook accepts an options object with a **queries** key whose value is an array with query option objects identical to the [`useQuery` hook](/reference/useQuery) (excluding the `context` option).
Copy file name to clipboardExpand all lines: docs/src/pages/reference/useQuery.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ const {
15
15
isFetchedAfterMount,
16
16
isFetching,
17
17
isPaused,
18
-
isIdle,
19
18
isLoading,
20
19
isLoadingError,
21
20
isPlaceholderData,
@@ -185,6 +184,8 @@ const result = useQuery({
185
184
- `meta: Record<string, unknown>`
186
185
- Optional
187
186
- If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`.
0 commit comments