@@ -118,12 +118,14 @@ import { Admin } from 'react-admin';
118
118
import { QueryClient } from ' react-query' ;
119
119
120
120
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
+ },
127
129
},
128
130
});
129
131
@@ -142,27 +144,29 @@ The common settings that react-admin developers often overwrite are:
142
144
import { QueryClient } from ' react-query' ;
143
145
144
146
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
+ },
166
170
},
167
171
});
168
172
```
0 commit comments