zova-module-a-model 5.0.11 → 5.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/config/config.ts +20 -0
- package/src/local/storage.ts +2 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-model",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.12",
|
|
4
4
|
"title": "a-model",
|
|
5
5
|
"zovaModule": {
|
|
6
6
|
"capabilities": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"js-cookie": "^3.0.5",
|
|
64
64
|
"localforage": "^1.10.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "807b688ca82f10a13844b0702d4dc7447e407457"
|
|
67
67
|
}
|
package/src/config/config.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import { DefaultOptions, defaultShouldDehydrateQuery } from '@tanstack/vue-query';
|
|
1
2
|
import { ZovaApplication } from 'zova';
|
|
2
3
|
|
|
4
|
+
const defaultOptions: DefaultOptions = {
|
|
5
|
+
queries: {
|
|
6
|
+
retry: false,
|
|
7
|
+
refetchOnWindowFocus: false,
|
|
8
|
+
refetchOnMount: false,
|
|
9
|
+
refetchOnReconnect: true,
|
|
10
|
+
gcTime: 1000 * 60 * 5,
|
|
11
|
+
},
|
|
12
|
+
dehydrate: {
|
|
13
|
+
shouldDehydrateQuery(query) {
|
|
14
|
+
if (query.meta?.ssr?.dehydrate === false) return false;
|
|
15
|
+
return defaultShouldDehydrateQuery(query);
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
3
20
|
export const config = (_app: ZovaApplication) => {
|
|
4
21
|
return {
|
|
5
22
|
persister: {
|
|
@@ -10,5 +27,8 @@ export const config = (_app: ZovaApplication) => {
|
|
|
10
27
|
maxAge: 1000 * 60 * 60 * 24, // 24 hours
|
|
11
28
|
},
|
|
12
29
|
},
|
|
30
|
+
queryClientConfig: {
|
|
31
|
+
defaultOptions,
|
|
32
|
+
},
|
|
13
33
|
};
|
|
14
34
|
};
|
package/src/local/storage.ts
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
import { BeanBase, Local } from 'zova';
|
|
2
2
|
import { ScopeModule } from '../resource/this.js';
|
|
3
|
-
import { VueQueryPlugin, VueQueryPluginOptions
|
|
3
|
+
import { VueQueryPlugin, VueQueryPluginOptions } from '@tanstack/vue-query';
|
|
4
4
|
|
|
5
5
|
@Local()
|
|
6
6
|
export class Storage extends BeanBase<ScopeModule> {
|
|
7
7
|
protected async __init__() {
|
|
8
8
|
const vueQueryPluginOptions: VueQueryPluginOptions = {
|
|
9
9
|
queryClientConfig: {
|
|
10
|
-
defaultOptions:
|
|
11
|
-
queries: {
|
|
12
|
-
retry: false,
|
|
13
|
-
refetchOnWindowFocus: false,
|
|
14
|
-
refetchOnMount: false,
|
|
15
|
-
refetchOnReconnect: false,
|
|
16
|
-
// gcTime: 1000 * 60 * 5,
|
|
17
|
-
},
|
|
18
|
-
dehydrate: {
|
|
19
|
-
shouldDehydrateQuery(query) {
|
|
20
|
-
if (query.meta?.ssr?.dehydrate === false) return false;
|
|
21
|
-
return defaultShouldDehydrateQuery(query);
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
10
|
+
defaultOptions: this.scope.config.queryClientConfig.defaultOptions,
|
|
25
11
|
},
|
|
26
12
|
};
|
|
27
13
|
this.app.vue.use(VueQueryPlugin, vueQueryPluginOptions);
|