Skip to content

Commit 6b067d9

Browse files
committed
Fix wrong syntax
1 parent f4c7e18 commit 6b067d9

File tree

2 files changed

+37
-31
lines changed

2 files changed

+37
-31
lines changed

docs/Admin.md

+31-27
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ import { Admin } from 'react-admin';
118118
import { QueryClient } from 'react-query';
119119

120120
const queryClient = new QueryClient({
121-
query: {
122-
retry: false,
123-
structuralSharing: false,
124-
},
125-
mutation: {
126-
retryDelay: 10000,
121+
defaultOptions: {
122+
queries: {
123+
retry: false,
124+
structuralSharing: false,
125+
},
126+
mutations: {
127+
retryDelay: 10000,
128+
},
127129
},
128130
});
129131

@@ -142,27 +144,29 @@ The common settings that react-admin developers often overwrite are:
142144
import { QueryClient } from 'react-query';
143145

144146
const queryClient = new QueryClient({
145-
query: {
146-
/**
147-
* The time in milliseconds after data is considered stale.
148-
* If set to `Infinity`, the data will never be considered stale.
149-
*/
150-
staleTime: 10000,
151-
/**
152-
* If `false`, failed queries will not retry by default.
153-
* If `true`, failed queries will retry infinitely., failureCount: num
154-
* If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
155-
* If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
156-
*/
157-
retry: false,
158-
/**
159-
* If set to `true`, the query will refetch on window focus if the data is stale.
160-
* If set to `false`, the query will not refetch on window focus.
161-
* If set to `'always'`, the query will always refetch on window focus.
162-
* If set to a function, the function will be executed with the latest data and query to compute the value.
163-
* Defaults to `true`.
164-
*/
165-
refetchOnWindowFocus: false,
147+
defaultOptions: {}
148+
queries: {
149+
/**
150+
* The time in milliseconds after data is considered stale.
151+
* If set to `Infinity`, the data will never be considered stale.
152+
*/
153+
staleTime: 10000,
154+
/**
155+
* If `false`, failed queries will not retry by default.
156+
* If `true`, failed queries will retry infinitely., failureCount: num
157+
* If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
158+
* If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
159+
*/
160+
retry: false,
161+
/**
162+
* If set to `true`, the query will refetch on window focus if the data is stale.
163+
* If set to `false`, the query will not refetch on window focus.
164+
* If set to `'always'`, the query will always refetch on window focus.
165+
* If set to a function, the function will be executed with the latest data and query to compute the value.
166+
* Defaults to `true`.
167+
*/
168+
refetchOnWindowFocus: false,
169+
},
166170
},
167171
});
168172
```

docs/DataProviders.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,12 @@ import { Admin } from 'react-admin';
374374
import { QueryClient } from 'react-query';
375375

376376
const queryClient = new QueryClient({
377-
query: {
378-
retry: false,
379-
staleTime: 10000,
380-
},
377+
defaultOptions: {
378+
queries: {
379+
retry: false,
380+
staleTime: Infinity,
381+
},
382+
}
381383
});
382384

383385
const App = () => (

0 commit comments

Comments
 (0)