@tanstack/react-query-persist-client 4.0.3 → 4.0.5
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/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js +3 -3
- package/build/cjs/react-query-persist-client/src/PersistQueryClientProvider.js.map +1 -1
- package/build/esm/index.js +9 -269
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats.json +53 -85
- package/build/umd/index.development.js +14 -274
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -22
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/build/cjs/react-query/build/esm/index.js +0 -301
- package/build/cjs/react-query/build/esm/index.js.map +0 -1
package/build/stats-html.html
CHANGED
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"query-core/build/esm/index.js","uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"query-core/build/esm/index.js","uid":"f3f3-265"},{"name":"react-query-persist-client/src","children":[{"uid":"f3f3-267","name":"persist.ts"},{"uid":"f3f3-271","name":"PersistQueryClientProvider.tsx"},{"uid":"f3f3-273","name":"retryStrategies.ts"},{"uid":"f3f3-275","name":"index.ts"}]}]},{"uid":"f3f3-269","name":"\u0000rollupPluginBabelHelpers.js"}]}],"isRoot":true},"nodeParts":{"f3f3-265":{"renderedLength":7950,"gzipLength":1867,"brotliLength":0,"mainUid":"f3f3-264"},"f3f3-267":{"renderedLength":2704,"gzipLength":803,"brotliLength":0,"mainUid":"f3f3-266"},"f3f3-269":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"f3f3-268"},"f3f3-271":{"renderedLength":1168,"gzipLength":430,"brotliLength":0,"mainUid":"f3f3-270"},"f3f3-273":{"renderedLength":687,"gzipLength":306,"brotliLength":0,"mainUid":"f3f3-272"},"f3f3-275":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"f3f3-274"}},"nodeMetas":{"f3f3-264":{"id":"/packages/query-core/build/esm/index.js","moduleParts":{"index.production.js":"f3f3-265"},"imported":[],"importedBy":[{"uid":"f3f3-266"}]},"f3f3-266":{"id":"/packages/react-query-persist-client/src/persist.ts","moduleParts":{"index.production.js":"f3f3-267"},"imported":[{"uid":"f3f3-264"}],"importedBy":[{"uid":"f3f3-274"},{"uid":"f3f3-270"}]},"f3f3-268":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"f3f3-269"},"imported":[],"importedBy":[{"uid":"f3f3-270"}]},"f3f3-270":{"id":"/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx","moduleParts":{"index.production.js":"f3f3-271"},"imported":[{"uid":"f3f3-268"},{"uid":"f3f3-276"},{"uid":"f3f3-266"},{"uid":"f3f3-277"}],"importedBy":[{"uid":"f3f3-274"}]},"f3f3-272":{"id":"/packages/react-query-persist-client/src/retryStrategies.ts","moduleParts":{"index.production.js":"f3f3-273"},"imported":[],"importedBy":[{"uid":"f3f3-274"}]},"f3f3-274":{"id":"/packages/react-query-persist-client/src/index.ts","moduleParts":{"index.production.js":"f3f3-275"},"imported":[{"uid":"f3f3-266"},{"uid":"f3f3-270"},{"uid":"f3f3-272"}],"importedBy":[],"isEntry":true},"f3f3-276":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"f3f3-270"}],"isExternal":true},"f3f3-277":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"f3f3-270"}],"isExternal":true}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats.json
CHANGED
|
@@ -11,37 +11,33 @@
|
|
|
11
11
|
"children": [
|
|
12
12
|
{
|
|
13
13
|
"name": "query-core/build/esm/index.js",
|
|
14
|
-
"uid": "
|
|
14
|
+
"uid": "f3f3-279"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "react-query-persist-client/src",
|
|
18
18
|
"children": [
|
|
19
19
|
{
|
|
20
|
-
"uid": "
|
|
20
|
+
"uid": "f3f3-281",
|
|
21
21
|
"name": "persist.ts"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"uid": "
|
|
24
|
+
"uid": "f3f3-285",
|
|
25
25
|
"name": "PersistQueryClientProvider.tsx"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
"uid": "
|
|
28
|
+
"uid": "f3f3-287",
|
|
29
29
|
"name": "retryStrategies.ts"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"uid": "
|
|
32
|
+
"uid": "f3f3-289",
|
|
33
33
|
"name": "index.ts"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "react-query/build/esm/index.js",
|
|
39
|
-
"uid": "f312-287"
|
|
40
36
|
}
|
|
41
37
|
]
|
|
42
38
|
},
|
|
43
39
|
{
|
|
44
|
-
"uid": "
|
|
40
|
+
"uid": "f3f3-283",
|
|
45
41
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
46
42
|
}
|
|
47
43
|
]
|
|
@@ -50,189 +46,161 @@
|
|
|
50
46
|
"isRoot": true
|
|
51
47
|
},
|
|
52
48
|
"nodeParts": {
|
|
53
|
-
"
|
|
54
|
-
"renderedLength":
|
|
55
|
-
"gzipLength":
|
|
49
|
+
"f3f3-279": {
|
|
50
|
+
"renderedLength": 7950,
|
|
51
|
+
"gzipLength": 1867,
|
|
56
52
|
"brotliLength": 0,
|
|
57
|
-
"mainUid": "
|
|
53
|
+
"mainUid": "f3f3-278"
|
|
58
54
|
},
|
|
59
|
-
"
|
|
55
|
+
"f3f3-281": {
|
|
60
56
|
"renderedLength": 2704,
|
|
61
57
|
"gzipLength": 803,
|
|
62
58
|
"brotliLength": 0,
|
|
63
|
-
"mainUid": "
|
|
59
|
+
"mainUid": "f3f3-280"
|
|
64
60
|
},
|
|
65
|
-
"
|
|
61
|
+
"f3f3-283": {
|
|
66
62
|
"renderedLength": 431,
|
|
67
63
|
"gzipLength": 240,
|
|
68
64
|
"brotliLength": 0,
|
|
69
|
-
"mainUid": "
|
|
65
|
+
"mainUid": "f3f3-282"
|
|
70
66
|
},
|
|
71
|
-
"
|
|
72
|
-
"renderedLength":
|
|
73
|
-
"gzipLength":
|
|
67
|
+
"f3f3-285": {
|
|
68
|
+
"renderedLength": 1168,
|
|
69
|
+
"gzipLength": 430,
|
|
74
70
|
"brotliLength": 0,
|
|
75
|
-
"mainUid": "
|
|
71
|
+
"mainUid": "f3f3-284"
|
|
76
72
|
},
|
|
77
|
-
"
|
|
78
|
-
"renderedLength": 1146,
|
|
79
|
-
"gzipLength": 425,
|
|
80
|
-
"brotliLength": 0,
|
|
81
|
-
"mainUid": "f312-288"
|
|
82
|
-
},
|
|
83
|
-
"f312-291": {
|
|
73
|
+
"f3f3-287": {
|
|
84
74
|
"renderedLength": 687,
|
|
85
75
|
"gzipLength": 306,
|
|
86
76
|
"brotliLength": 0,
|
|
87
|
-
"mainUid": "
|
|
77
|
+
"mainUid": "f3f3-286"
|
|
88
78
|
},
|
|
89
|
-
"
|
|
79
|
+
"f3f3-289": {
|
|
90
80
|
"renderedLength": 0,
|
|
91
81
|
"gzipLength": 0,
|
|
92
82
|
"brotliLength": 0,
|
|
93
|
-
"mainUid": "
|
|
83
|
+
"mainUid": "f3f3-288"
|
|
94
84
|
}
|
|
95
85
|
},
|
|
96
86
|
"nodeMetas": {
|
|
97
|
-
"
|
|
87
|
+
"f3f3-278": {
|
|
98
88
|
"id": "/packages/query-core/build/esm/index.js",
|
|
99
89
|
"moduleParts": {
|
|
100
|
-
"index.production.js": "
|
|
90
|
+
"index.production.js": "f3f3-279"
|
|
101
91
|
},
|
|
102
92
|
"imported": [],
|
|
103
93
|
"importedBy": [
|
|
104
94
|
{
|
|
105
|
-
"uid": "
|
|
95
|
+
"uid": "f3f3-280"
|
|
106
96
|
}
|
|
107
97
|
]
|
|
108
98
|
},
|
|
109
|
-
"
|
|
99
|
+
"f3f3-280": {
|
|
110
100
|
"id": "/packages/react-query-persist-client/src/persist.ts",
|
|
111
101
|
"moduleParts": {
|
|
112
|
-
"index.production.js": "
|
|
102
|
+
"index.production.js": "f3f3-281"
|
|
113
103
|
},
|
|
114
104
|
"imported": [
|
|
115
105
|
{
|
|
116
|
-
"uid": "
|
|
106
|
+
"uid": "f3f3-278"
|
|
117
107
|
}
|
|
118
108
|
],
|
|
119
109
|
"importedBy": [
|
|
120
110
|
{
|
|
121
|
-
"uid": "
|
|
111
|
+
"uid": "f3f3-288"
|
|
122
112
|
},
|
|
123
113
|
{
|
|
124
|
-
"uid": "
|
|
114
|
+
"uid": "f3f3-284"
|
|
125
115
|
}
|
|
126
116
|
]
|
|
127
117
|
},
|
|
128
|
-
"
|
|
118
|
+
"f3f3-282": {
|
|
129
119
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
130
120
|
"moduleParts": {
|
|
131
|
-
"index.production.js": "
|
|
121
|
+
"index.production.js": "f3f3-283"
|
|
132
122
|
},
|
|
133
123
|
"imported": [],
|
|
134
124
|
"importedBy": [
|
|
135
125
|
{
|
|
136
|
-
"uid": "
|
|
126
|
+
"uid": "f3f3-284"
|
|
137
127
|
}
|
|
138
128
|
]
|
|
139
129
|
},
|
|
140
|
-
"
|
|
141
|
-
"id": "/packages/react-query/build/esm/index.js",
|
|
142
|
-
"moduleParts": {
|
|
143
|
-
"index.production.js": "f312-287"
|
|
144
|
-
},
|
|
145
|
-
"imported": [
|
|
146
|
-
{
|
|
147
|
-
"uid": "f312-294"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"uid": "f312-295"
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
"importedBy": [
|
|
154
|
-
{
|
|
155
|
-
"uid": "f312-288"
|
|
156
|
-
}
|
|
157
|
-
]
|
|
158
|
-
},
|
|
159
|
-
"f312-288": {
|
|
130
|
+
"f3f3-284": {
|
|
160
131
|
"id": "/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx",
|
|
161
132
|
"moduleParts": {
|
|
162
|
-
"index.production.js": "
|
|
133
|
+
"index.production.js": "f3f3-285"
|
|
163
134
|
},
|
|
164
135
|
"imported": [
|
|
165
136
|
{
|
|
166
|
-
"uid": "
|
|
137
|
+
"uid": "f3f3-282"
|
|
167
138
|
},
|
|
168
139
|
{
|
|
169
|
-
"uid": "
|
|
140
|
+
"uid": "f3f3-290"
|
|
170
141
|
},
|
|
171
142
|
{
|
|
172
|
-
"uid": "
|
|
143
|
+
"uid": "f3f3-280"
|
|
173
144
|
},
|
|
174
145
|
{
|
|
175
|
-
"uid": "
|
|
146
|
+
"uid": "f3f3-291"
|
|
176
147
|
}
|
|
177
148
|
],
|
|
178
149
|
"importedBy": [
|
|
179
150
|
{
|
|
180
|
-
"uid": "
|
|
151
|
+
"uid": "f3f3-288"
|
|
181
152
|
}
|
|
182
153
|
]
|
|
183
154
|
},
|
|
184
|
-
"
|
|
155
|
+
"f3f3-286": {
|
|
185
156
|
"id": "/packages/react-query-persist-client/src/retryStrategies.ts",
|
|
186
157
|
"moduleParts": {
|
|
187
|
-
"index.production.js": "
|
|
158
|
+
"index.production.js": "f3f3-287"
|
|
188
159
|
},
|
|
189
160
|
"imported": [],
|
|
190
161
|
"importedBy": [
|
|
191
162
|
{
|
|
192
|
-
"uid": "
|
|
163
|
+
"uid": "f3f3-288"
|
|
193
164
|
}
|
|
194
165
|
]
|
|
195
166
|
},
|
|
196
|
-
"
|
|
167
|
+
"f3f3-288": {
|
|
197
168
|
"id": "/packages/react-query-persist-client/src/index.ts",
|
|
198
169
|
"moduleParts": {
|
|
199
|
-
"index.production.js": "
|
|
170
|
+
"index.production.js": "f3f3-289"
|
|
200
171
|
},
|
|
201
172
|
"imported": [
|
|
202
173
|
{
|
|
203
|
-
"uid": "
|
|
174
|
+
"uid": "f3f3-280"
|
|
204
175
|
},
|
|
205
176
|
{
|
|
206
|
-
"uid": "
|
|
177
|
+
"uid": "f3f3-284"
|
|
207
178
|
},
|
|
208
179
|
{
|
|
209
|
-
"uid": "
|
|
180
|
+
"uid": "f3f3-286"
|
|
210
181
|
}
|
|
211
182
|
],
|
|
212
183
|
"importedBy": [],
|
|
213
184
|
"isEntry": true
|
|
214
185
|
},
|
|
215
|
-
"
|
|
186
|
+
"f3f3-290": {
|
|
216
187
|
"id": "react",
|
|
217
188
|
"moduleParts": {},
|
|
218
189
|
"imported": [],
|
|
219
190
|
"importedBy": [
|
|
220
191
|
{
|
|
221
|
-
"uid": "
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"uid": "f312-286"
|
|
192
|
+
"uid": "f3f3-284"
|
|
225
193
|
}
|
|
226
194
|
],
|
|
227
195
|
"isExternal": true
|
|
228
196
|
},
|
|
229
|
-
"
|
|
230
|
-
"id": "
|
|
197
|
+
"f3f3-291": {
|
|
198
|
+
"id": "@tanstack/react-query",
|
|
231
199
|
"moduleParts": {},
|
|
232
200
|
"imported": [],
|
|
233
201
|
"importedBy": [
|
|
234
202
|
{
|
|
235
|
-
"uid": "
|
|
203
|
+
"uid": "f3f3-284"
|
|
236
204
|
}
|
|
237
205
|
],
|
|
238
206
|
"isExternal": true
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('
|
|
13
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '
|
|
14
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryPersistClient = {}, global.React));
|
|
15
|
-
})(this, (function (exports, React) { 'use strict';
|
|
12
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@tanstack/react-query')) :
|
|
13
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@tanstack/react-query'], factory) :
|
|
14
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryPersistClient = {}, global.React, global.ReactQuery));
|
|
15
|
+
})(this, (function (exports, React, reactQuery) { 'use strict';
|
|
16
16
|
|
|
17
17
|
function _interopNamespace(e) {
|
|
18
18
|
if (e && e.__esModule) return e;
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
*
|
|
45
45
|
* @license MIT
|
|
46
46
|
*/
|
|
47
|
-
class Subscribable
|
|
47
|
+
class Subscribable {
|
|
48
48
|
constructor() {
|
|
49
49
|
this.listeners = [];
|
|
50
50
|
this.subscribe = this.subscribe.bind(this);
|
|
@@ -73,16 +73,16 @@
|
|
|
73
73
|
|
|
74
74
|
// TYPES
|
|
75
75
|
// UTILS
|
|
76
|
-
const isServer
|
|
76
|
+
const isServer = typeof window === 'undefined';
|
|
77
77
|
|
|
78
|
-
class FocusManager
|
|
78
|
+
class FocusManager extends Subscribable {
|
|
79
79
|
constructor() {
|
|
80
80
|
super();
|
|
81
81
|
|
|
82
82
|
this.setup = onFocus => {
|
|
83
83
|
// addEventListener does not exist in React Native, but window does
|
|
84
84
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
85
|
-
if (!isServer
|
|
85
|
+
if (!isServer && window.addEventListener) {
|
|
86
86
|
const listener = () => onFocus(); // Listen to visibillitychange and focus
|
|
87
87
|
|
|
88
88
|
|
|
@@ -154,16 +154,16 @@
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
}
|
|
157
|
-
new FocusManager
|
|
157
|
+
new FocusManager();
|
|
158
158
|
|
|
159
|
-
class OnlineManager
|
|
159
|
+
class OnlineManager extends Subscribable {
|
|
160
160
|
constructor() {
|
|
161
161
|
super();
|
|
162
162
|
|
|
163
163
|
this.setup = onOnline => {
|
|
164
164
|
// addEventListener does not exist in React Native, but window does
|
|
165
165
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
166
|
-
if (!isServer
|
|
166
|
+
if (!isServer && window.addEventListener) {
|
|
167
167
|
const listener = () => onOnline(); // Listen to online
|
|
168
168
|
|
|
169
169
|
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
}
|
|
237
|
-
new OnlineManager
|
|
237
|
+
new OnlineManager();
|
|
238
238
|
|
|
239
239
|
// TYPES
|
|
240
240
|
// FUNCTIONS
|
|
@@ -446,266 +446,6 @@
|
|
|
446
446
|
return _extends.apply(this, arguments);
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
/**
|
|
450
|
-
* react-query
|
|
451
|
-
*
|
|
452
|
-
* Copyright (c) TanStack
|
|
453
|
-
*
|
|
454
|
-
* This source code is licensed under the MIT license found in the
|
|
455
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
456
|
-
*
|
|
457
|
-
* @license MIT
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* query-core
|
|
462
|
-
*
|
|
463
|
-
* Copyright (c) TanStack
|
|
464
|
-
*
|
|
465
|
-
* This source code is licensed under the MIT license found in the
|
|
466
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
467
|
-
*
|
|
468
|
-
* @license MIT
|
|
469
|
-
*/
|
|
470
|
-
class Subscribable {
|
|
471
|
-
constructor() {
|
|
472
|
-
this.listeners = [];
|
|
473
|
-
this.subscribe = this.subscribe.bind(this);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
subscribe(listener) {
|
|
477
|
-
this.listeners.push(listener);
|
|
478
|
-
this.onSubscribe();
|
|
479
|
-
return () => {
|
|
480
|
-
this.listeners = this.listeners.filter(x => x !== listener);
|
|
481
|
-
this.onUnsubscribe();
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
hasListeners() {
|
|
486
|
-
return this.listeners.length > 0;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
onSubscribe() {// Do nothing
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
onUnsubscribe() {// Do nothing
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// TYPES
|
|
498
|
-
// UTILS
|
|
499
|
-
const isServer = typeof window === 'undefined';
|
|
500
|
-
|
|
501
|
-
class FocusManager extends Subscribable {
|
|
502
|
-
constructor() {
|
|
503
|
-
super();
|
|
504
|
-
|
|
505
|
-
this.setup = onFocus => {
|
|
506
|
-
// addEventListener does not exist in React Native, but window does
|
|
507
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
508
|
-
if (!isServer && window.addEventListener) {
|
|
509
|
-
const listener = () => onFocus(); // Listen to visibillitychange and focus
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
window.addEventListener('visibilitychange', listener, false);
|
|
513
|
-
window.addEventListener('focus', listener, false);
|
|
514
|
-
return () => {
|
|
515
|
-
// Be sure to unsubscribe if a new handler is set
|
|
516
|
-
window.removeEventListener('visibilitychange', listener);
|
|
517
|
-
window.removeEventListener('focus', listener);
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
onSubscribe() {
|
|
524
|
-
if (!this.cleanup) {
|
|
525
|
-
this.setEventListener(this.setup);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
onUnsubscribe() {
|
|
530
|
-
if (!this.hasListeners()) {
|
|
531
|
-
var _this$cleanup;
|
|
532
|
-
|
|
533
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
534
|
-
this.cleanup = undefined;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
setEventListener(setup) {
|
|
539
|
-
var _this$cleanup2;
|
|
540
|
-
|
|
541
|
-
this.setup = setup;
|
|
542
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
543
|
-
this.cleanup = setup(focused => {
|
|
544
|
-
if (typeof focused === 'boolean') {
|
|
545
|
-
this.setFocused(focused);
|
|
546
|
-
} else {
|
|
547
|
-
this.onFocus();
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
setFocused(focused) {
|
|
553
|
-
this.focused = focused;
|
|
554
|
-
|
|
555
|
-
if (focused) {
|
|
556
|
-
this.onFocus();
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
onFocus() {
|
|
561
|
-
this.listeners.forEach(listener => {
|
|
562
|
-
listener();
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
isFocused() {
|
|
567
|
-
if (typeof this.focused === 'boolean') {
|
|
568
|
-
return this.focused;
|
|
569
|
-
} // document global can be unavailable in react native
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (typeof document === 'undefined') {
|
|
573
|
-
return true;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
}
|
|
580
|
-
new FocusManager();
|
|
581
|
-
|
|
582
|
-
class OnlineManager extends Subscribable {
|
|
583
|
-
constructor() {
|
|
584
|
-
super();
|
|
585
|
-
|
|
586
|
-
this.setup = onOnline => {
|
|
587
|
-
// addEventListener does not exist in React Native, but window does
|
|
588
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
589
|
-
if (!isServer && window.addEventListener) {
|
|
590
|
-
const listener = () => onOnline(); // Listen to online
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
window.addEventListener('online', listener, false);
|
|
594
|
-
window.addEventListener('offline', listener, false);
|
|
595
|
-
return () => {
|
|
596
|
-
// Be sure to unsubscribe if a new handler is set
|
|
597
|
-
window.removeEventListener('online', listener);
|
|
598
|
-
window.removeEventListener('offline', listener);
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
onSubscribe() {
|
|
605
|
-
if (!this.cleanup) {
|
|
606
|
-
this.setEventListener(this.setup);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
onUnsubscribe() {
|
|
611
|
-
if (!this.hasListeners()) {
|
|
612
|
-
var _this$cleanup;
|
|
613
|
-
|
|
614
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
615
|
-
this.cleanup = undefined;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
setEventListener(setup) {
|
|
620
|
-
var _this$cleanup2;
|
|
621
|
-
|
|
622
|
-
this.setup = setup;
|
|
623
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
624
|
-
this.cleanup = setup(online => {
|
|
625
|
-
if (typeof online === 'boolean') {
|
|
626
|
-
this.setOnline(online);
|
|
627
|
-
} else {
|
|
628
|
-
this.onOnline();
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
setOnline(online) {
|
|
634
|
-
this.online = online;
|
|
635
|
-
|
|
636
|
-
if (online) {
|
|
637
|
-
this.onOnline();
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
onOnline() {
|
|
642
|
-
this.listeners.forEach(listener => {
|
|
643
|
-
listener();
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
isOnline() {
|
|
648
|
-
if (typeof this.online === 'boolean') {
|
|
649
|
-
return this.online;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {
|
|
653
|
-
return true;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
return navigator.onLine;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
new OnlineManager();
|
|
661
|
-
|
|
662
|
-
const defaultContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
663
|
-
const QueryClientSharingContext = /*#__PURE__*/React__namespace.createContext(false); // If we are given a context, we will use it.
|
|
664
|
-
// Otherwise, if contextSharing is on, we share the first and at least one
|
|
665
|
-
// instance of the context across the window
|
|
666
|
-
// to ensure that if React Query is used across
|
|
667
|
-
// different bundles or microfrontends they will
|
|
668
|
-
// all use the same **instance** of context, regardless
|
|
669
|
-
// of module scoping.
|
|
670
|
-
|
|
671
|
-
function getQueryClientContext(context, contextSharing) {
|
|
672
|
-
if (context) {
|
|
673
|
-
return context;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
if (contextSharing && typeof window !== 'undefined') {
|
|
677
|
-
if (!window.ReactQueryClientContext) {
|
|
678
|
-
window.ReactQueryClientContext = defaultContext;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
return window.ReactQueryClientContext;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
return defaultContext;
|
|
685
|
-
}
|
|
686
|
-
const QueryClientProvider = ({
|
|
687
|
-
client,
|
|
688
|
-
children,
|
|
689
|
-
context,
|
|
690
|
-
contextSharing = false
|
|
691
|
-
}) => {
|
|
692
|
-
React__namespace.useEffect(() => {
|
|
693
|
-
client.mount();
|
|
694
|
-
return () => {
|
|
695
|
-
client.unmount();
|
|
696
|
-
};
|
|
697
|
-
}, [client]);
|
|
698
|
-
const Context = getQueryClientContext(context, contextSharing);
|
|
699
|
-
return /*#__PURE__*/React__namespace.createElement(QueryClientSharingContext.Provider, {
|
|
700
|
-
value: !context && contextSharing
|
|
701
|
-
}, /*#__PURE__*/React__namespace.createElement(Context.Provider, {
|
|
702
|
-
value: client
|
|
703
|
-
}, children));
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
const IsRestoringContext = /*#__PURE__*/React__namespace.createContext(false);
|
|
707
|
-
const IsRestoringProvider = IsRestoringContext.Provider;
|
|
708
|
-
|
|
709
449
|
const PersistQueryClientProvider = ({
|
|
710
450
|
client,
|
|
711
451
|
children,
|
|
@@ -741,9 +481,9 @@
|
|
|
741
481
|
unsubscribe();
|
|
742
482
|
};
|
|
743
483
|
}, [client]);
|
|
744
|
-
return /*#__PURE__*/React__namespace.createElement(QueryClientProvider, _extends({
|
|
484
|
+
return /*#__PURE__*/React__namespace.createElement(reactQuery.QueryClientProvider, _extends({
|
|
745
485
|
client: client
|
|
746
|
-
}, props), /*#__PURE__*/React__namespace.createElement(IsRestoringProvider, {
|
|
486
|
+
}, props), /*#__PURE__*/React__namespace.createElement(reactQuery.IsRestoringProvider, {
|
|
747
487
|
value: isRestoring
|
|
748
488
|
}, children));
|
|
749
489
|
};
|