Skip to content

Commit f11167f

Browse files
authored
Merge pull request #8 from ylc395/perf/disable-structural-sharing
perf: disable structural sharing for preset
2 parents ca62d07 + 09fa1d9 commit f11167f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,10 @@ import { queryClient } from "mobx-tanstack-query/preset";
380380

381381
const defaultOptions = queryClient.getDefaultOptions();
382382
defaultOptions.queries!.refetchOnMount = true;
383-
queryClient.setDefaultOptions({ ...defaultOptions })─────────────────────────────────────────────────────────────────────────────────────────────────────────(js2me@js2me-B560-HD3:pts/9)─┐
384-
└─(12:51:47 on master)──>
383+
queryClient.setDefaultOptions({ ...defaultOptions })
384+
```
385+
386+
385387
P.S. Overriding default options should be written before start whole application
386388

387389

src/preset/configs/default-query-client-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const defaultQueryClientConfig = {
1111
queryKeyHashFn: hashKey,
1212
refetchOnWindowFocus: 'always',
1313
refetchOnReconnect: 'always',
14+
structuralSharing: false, // see https://github.com/js2me/mobx-tanstack-query/issues/7
1415
staleTime: 5 * 60 * 1000,
1516
retry: (failureCount, error) => {
1617
if (error instanceof Response && error.status >= 500) {

0 commit comments

Comments
 (0)