@tanstack/react-query-persist-client 4.0.3 → 4.0.10

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.
@@ -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":"f312-265"},{"name":"react-query-persist-client/src","children":[{"uid":"f312-267","name":"persist.ts"},{"uid":"f312-273","name":"PersistQueryClientProvider.tsx"},{"uid":"f312-275","name":"retryStrategies.ts"},{"uid":"f312-277","name":"index.ts"}]},{"name":"react-query/build/esm/index.js","uid":"f312-271"}]},{"uid":"f312-269","name":"\u0000rollupPluginBabelHelpers.js"}]}],"isRoot":true},"nodeParts":{"f312-265":{"renderedLength":7970,"gzipLength":1872,"brotliLength":0,"mainUid":"f312-264"},"f312-267":{"renderedLength":2704,"gzipLength":803,"brotliLength":0,"mainUid":"f312-266"},"f312-269":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"f312-268"},"f312-271":{"renderedLength":6581,"gzipLength":1582,"brotliLength":0,"mainUid":"f312-270"},"f312-273":{"renderedLength":1146,"gzipLength":425,"brotliLength":0,"mainUid":"f312-272"},"f312-275":{"renderedLength":687,"gzipLength":306,"brotliLength":0,"mainUid":"f312-274"},"f312-277":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"f312-276"}},"nodeMetas":{"f312-264":{"id":"/packages/query-core/build/esm/index.js","moduleParts":{"index.production.js":"f312-265"},"imported":[],"importedBy":[{"uid":"f312-266"}]},"f312-266":{"id":"/packages/react-query-persist-client/src/persist.ts","moduleParts":{"index.production.js":"f312-267"},"imported":[{"uid":"f312-264"}],"importedBy":[{"uid":"f312-276"},{"uid":"f312-272"}]},"f312-268":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"f312-269"},"imported":[],"importedBy":[{"uid":"f312-272"}]},"f312-270":{"id":"/packages/react-query/build/esm/index.js","moduleParts":{"index.production.js":"f312-271"},"imported":[{"uid":"f312-278"},{"uid":"f312-279"}],"importedBy":[{"uid":"f312-272"}]},"f312-272":{"id":"/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx","moduleParts":{"index.production.js":"f312-273"},"imported":[{"uid":"f312-268"},{"uid":"f312-278"},{"uid":"f312-266"},{"uid":"f312-270"}],"importedBy":[{"uid":"f312-276"}]},"f312-274":{"id":"/packages/react-query-persist-client/src/retryStrategies.ts","moduleParts":{"index.production.js":"f312-275"},"imported":[],"importedBy":[{"uid":"f312-276"}]},"f312-276":{"id":"/packages/react-query-persist-client/src/index.ts","moduleParts":{"index.production.js":"f312-277"},"imported":[{"uid":"f312-266"},{"uid":"f312-272"},{"uid":"f312-274"}],"importedBy":[],"isEntry":true},"f312-278":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"f312-272"},{"uid":"f312-270"}],"isExternal":true},"f312-279":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"f312-270"}],"isExternal":true}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
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":"f80b-249"},{"name":"react-query-persist-client/src","children":[{"uid":"f80b-251","name":"persist.ts"},{"uid":"f80b-255","name":"PersistQueryClientProvider.tsx"},{"uid":"f80b-257","name":"retryStrategies.ts"},{"uid":"f80b-259","name":"index.ts"}]}]},{"uid":"f80b-253","name":"\u0000rollupPluginBabelHelpers.js"}]}],"isRoot":true},"nodeParts":{"f80b-249":{"renderedLength":7950,"gzipLength":1867,"brotliLength":0,"mainUid":"f80b-248"},"f80b-251":{"renderedLength":2704,"gzipLength":803,"brotliLength":0,"mainUid":"f80b-250"},"f80b-253":{"renderedLength":431,"gzipLength":240,"brotliLength":0,"mainUid":"f80b-252"},"f80b-255":{"renderedLength":1168,"gzipLength":430,"brotliLength":0,"mainUid":"f80b-254"},"f80b-257":{"renderedLength":687,"gzipLength":306,"brotliLength":0,"mainUid":"f80b-256"},"f80b-259":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"f80b-258"}},"nodeMetas":{"f80b-248":{"id":"/packages/query-core/build/esm/index.js","moduleParts":{"index.production.js":"f80b-249"},"imported":[],"importedBy":[{"uid":"f80b-250"}]},"f80b-250":{"id":"/packages/react-query-persist-client/src/persist.ts","moduleParts":{"index.production.js":"f80b-251"},"imported":[{"uid":"f80b-248"}],"importedBy":[{"uid":"f80b-258"},{"uid":"f80b-254"}]},"f80b-252":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"f80b-253"},"imported":[],"importedBy":[{"uid":"f80b-254"}]},"f80b-254":{"id":"/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx","moduleParts":{"index.production.js":"f80b-255"},"imported":[{"uid":"f80b-252"},{"uid":"f80b-260"},{"uid":"f80b-250"},{"uid":"f80b-261"}],"importedBy":[{"uid":"f80b-258"}]},"f80b-256":{"id":"/packages/react-query-persist-client/src/retryStrategies.ts","moduleParts":{"index.production.js":"f80b-257"},"imported":[],"importedBy":[{"uid":"f80b-258"}]},"f80b-258":{"id":"/packages/react-query-persist-client/src/index.ts","moduleParts":{"index.production.js":"f80b-259"},"imported":[{"uid":"f80b-250"},{"uid":"f80b-254"},{"uid":"f80b-256"}],"importedBy":[],"isEntry":true},"f80b-260":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"f80b-254"}],"isExternal":true},"f80b-261":{"id":"@tanstack/react-query","moduleParts":{},"imported":[],"importedBy":[{"uid":"f80b-254"}],"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": "f312-281"
14
+ "uid": "f80b-263"
15
15
  },
16
16
  {
17
17
  "name": "react-query-persist-client/src",
18
18
  "children": [
19
19
  {
20
- "uid": "f312-283",
20
+ "uid": "f80b-265",
21
21
  "name": "persist.ts"
22
22
  },
23
23
  {
24
- "uid": "f312-289",
24
+ "uid": "f80b-269",
25
25
  "name": "PersistQueryClientProvider.tsx"
26
26
  },
27
27
  {
28
- "uid": "f312-291",
28
+ "uid": "f80b-271",
29
29
  "name": "retryStrategies.ts"
30
30
  },
31
31
  {
32
- "uid": "f312-293",
32
+ "uid": "f80b-273",
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": "f312-285",
40
+ "uid": "f80b-267",
45
41
  "name": "\u0000rollupPluginBabelHelpers.js"
46
42
  }
47
43
  ]
@@ -50,189 +46,161 @@
50
46
  "isRoot": true
51
47
  },
52
48
  "nodeParts": {
53
- "f312-281": {
54
- "renderedLength": 7970,
55
- "gzipLength": 1872,
49
+ "f80b-263": {
50
+ "renderedLength": 7950,
51
+ "gzipLength": 1867,
56
52
  "brotliLength": 0,
57
- "mainUid": "f312-280"
53
+ "mainUid": "f80b-262"
58
54
  },
59
- "f312-283": {
55
+ "f80b-265": {
60
56
  "renderedLength": 2704,
61
57
  "gzipLength": 803,
62
58
  "brotliLength": 0,
63
- "mainUid": "f312-282"
59
+ "mainUid": "f80b-264"
64
60
  },
65
- "f312-285": {
61
+ "f80b-267": {
66
62
  "renderedLength": 431,
67
63
  "gzipLength": 240,
68
64
  "brotliLength": 0,
69
- "mainUid": "f312-284"
65
+ "mainUid": "f80b-266"
70
66
  },
71
- "f312-287": {
72
- "renderedLength": 6581,
73
- "gzipLength": 1582,
67
+ "f80b-269": {
68
+ "renderedLength": 1168,
69
+ "gzipLength": 430,
74
70
  "brotliLength": 0,
75
- "mainUid": "f312-286"
71
+ "mainUid": "f80b-268"
76
72
  },
77
- "f312-289": {
78
- "renderedLength": 1146,
79
- "gzipLength": 425,
80
- "brotliLength": 0,
81
- "mainUid": "f312-288"
82
- },
83
- "f312-291": {
73
+ "f80b-271": {
84
74
  "renderedLength": 687,
85
75
  "gzipLength": 306,
86
76
  "brotliLength": 0,
87
- "mainUid": "f312-290"
77
+ "mainUid": "f80b-270"
88
78
  },
89
- "f312-293": {
79
+ "f80b-273": {
90
80
  "renderedLength": 0,
91
81
  "gzipLength": 0,
92
82
  "brotliLength": 0,
93
- "mainUid": "f312-292"
83
+ "mainUid": "f80b-272"
94
84
  }
95
85
  },
96
86
  "nodeMetas": {
97
- "f312-280": {
87
+ "f80b-262": {
98
88
  "id": "/packages/query-core/build/esm/index.js",
99
89
  "moduleParts": {
100
- "index.production.js": "f312-281"
90
+ "index.production.js": "f80b-263"
101
91
  },
102
92
  "imported": [],
103
93
  "importedBy": [
104
94
  {
105
- "uid": "f312-282"
95
+ "uid": "f80b-264"
106
96
  }
107
97
  ]
108
98
  },
109
- "f312-282": {
99
+ "f80b-264": {
110
100
  "id": "/packages/react-query-persist-client/src/persist.ts",
111
101
  "moduleParts": {
112
- "index.production.js": "f312-283"
102
+ "index.production.js": "f80b-265"
113
103
  },
114
104
  "imported": [
115
105
  {
116
- "uid": "f312-280"
106
+ "uid": "f80b-262"
117
107
  }
118
108
  ],
119
109
  "importedBy": [
120
110
  {
121
- "uid": "f312-292"
111
+ "uid": "f80b-272"
122
112
  },
123
113
  {
124
- "uid": "f312-288"
114
+ "uid": "f80b-268"
125
115
  }
126
116
  ]
127
117
  },
128
- "f312-284": {
118
+ "f80b-266": {
129
119
  "id": "\u0000rollupPluginBabelHelpers.js",
130
120
  "moduleParts": {
131
- "index.production.js": "f312-285"
121
+ "index.production.js": "f80b-267"
132
122
  },
133
123
  "imported": [],
134
124
  "importedBy": [
135
125
  {
136
- "uid": "f312-288"
126
+ "uid": "f80b-268"
137
127
  }
138
128
  ]
139
129
  },
140
- "f312-286": {
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
+ "f80b-268": {
160
131
  "id": "/packages/react-query-persist-client/src/PersistQueryClientProvider.tsx",
161
132
  "moduleParts": {
162
- "index.production.js": "f312-289"
133
+ "index.production.js": "f80b-269"
163
134
  },
164
135
  "imported": [
165
136
  {
166
- "uid": "f312-284"
137
+ "uid": "f80b-266"
167
138
  },
168
139
  {
169
- "uid": "f312-294"
140
+ "uid": "f80b-274"
170
141
  },
171
142
  {
172
- "uid": "f312-282"
143
+ "uid": "f80b-264"
173
144
  },
174
145
  {
175
- "uid": "f312-286"
146
+ "uid": "f80b-275"
176
147
  }
177
148
  ],
178
149
  "importedBy": [
179
150
  {
180
- "uid": "f312-292"
151
+ "uid": "f80b-272"
181
152
  }
182
153
  ]
183
154
  },
184
- "f312-290": {
155
+ "f80b-270": {
185
156
  "id": "/packages/react-query-persist-client/src/retryStrategies.ts",
186
157
  "moduleParts": {
187
- "index.production.js": "f312-291"
158
+ "index.production.js": "f80b-271"
188
159
  },
189
160
  "imported": [],
190
161
  "importedBy": [
191
162
  {
192
- "uid": "f312-292"
163
+ "uid": "f80b-272"
193
164
  }
194
165
  ]
195
166
  },
196
- "f312-292": {
167
+ "f80b-272": {
197
168
  "id": "/packages/react-query-persist-client/src/index.ts",
198
169
  "moduleParts": {
199
- "index.production.js": "f312-293"
170
+ "index.production.js": "f80b-273"
200
171
  },
201
172
  "imported": [
202
173
  {
203
- "uid": "f312-282"
174
+ "uid": "f80b-264"
204
175
  },
205
176
  {
206
- "uid": "f312-288"
177
+ "uid": "f80b-268"
207
178
  },
208
179
  {
209
- "uid": "f312-290"
180
+ "uid": "f80b-270"
210
181
  }
211
182
  ],
212
183
  "importedBy": [],
213
184
  "isEntry": true
214
185
  },
215
- "f312-294": {
186
+ "f80b-274": {
216
187
  "id": "react",
217
188
  "moduleParts": {},
218
189
  "imported": [],
219
190
  "importedBy": [
220
191
  {
221
- "uid": "f312-288"
222
- },
223
- {
224
- "uid": "f312-286"
192
+ "uid": "f80b-268"
225
193
  }
226
194
  ],
227
195
  "isExternal": true
228
196
  },
229
- "f312-295": {
230
- "id": "use-sync-external-store/shim",
197
+ "f80b-275": {
198
+ "id": "@tanstack/react-query",
231
199
  "moduleParts": {},
232
200
  "imported": [],
233
201
  "importedBy": [
234
202
  {
235
- "uid": "f312-286"
203
+ "uid": "f80b-268"
236
204
  }
237
205
  ],
238
206
  "isExternal": true
@@ -6,15 +6,18 @@ export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData
6
6
  export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'initialData'> & {
7
7
  initialData: TQueryFnData | (() => TQueryFnData);
8
8
  }): DefinedUseQueryResult<TData, TError>;
9
+ export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>): UseQueryResult<TData, TError>;
9
10
  export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'initialData'> & {
10
11
  initialData?: () => undefined;
11
12
  }): UseQueryResult<TData, TError>;
12
13
  export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'initialData'> & {
13
14
  initialData: TQueryFnData | (() => TQueryFnData);
14
15
  }): DefinedUseQueryResult<TData, TError>;
16
+ export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey'>): UseQueryResult<TData, TError>;
15
17
  export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, queryFn: QueryFunction<TQueryFnData, TQueryKey>, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn' | 'initialData'> & {
16
18
  initialData?: () => undefined;
17
19
  }): UseQueryResult<TData, TError>;
18
20
  export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, queryFn: QueryFunction<TQueryFnData, TQueryKey>, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn' | 'initialData'> & {
19
21
  initialData: TQueryFnData | (() => TQueryFnData);
20
22
  }): DefinedUseQueryResult<TData, TError>;
23
+ export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, queryFn: QueryFunction<TQueryFnData, TQueryKey>, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn'>): UseQueryResult<TData, TError>;
@@ -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('use-sync-external-store/shim')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim'], factory) :
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$1 {
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$1 = typeof window === 'undefined';
76
+ const isServer = typeof window === 'undefined';
77
77
 
78
- class FocusManager$1 extends Subscribable$1 {
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$1 && window.addEventListener) {
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$1();
157
+ new FocusManager();
158
158
 
159
- class OnlineManager$1 extends Subscribable$1 {
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$1 && window.addEventListener) {
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$1();
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
  };