@elice/material-shared-utils 1.260128.0-rc.0 → 1.260129.0

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.
Files changed (46) hide show
  1. package/cjs/hooks/useHelpyLogo.js +2 -2
  2. package/es/hooks/useCallbackProp.js +3 -3
  3. package/es/hooks/useDeepClonedCompareEffect.js +2 -2
  4. package/es/hooks/useHelpyLogo.js +1 -1
  5. package/es/material-config/MaterialConfigProvider.js +5 -5
  6. package/package.json +5 -3
  7. package/cjs/_virtual/index.js +0 -5
  8. package/cjs/_virtual/use-sync-external-store-shim.production.js +0 -5
  9. package/cjs/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -93
  10. package/cjs/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -101
  11. package/cjs/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -95
  12. package/cjs/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -571
  13. package/cjs/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -21
  14. package/cjs/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -33
  15. package/cjs/node_modules/@tanstack/query-core/build/lib/utils.js +0 -154
  16. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -65
  17. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -46
  18. package/cjs/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -52
  19. package/cjs/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -31
  20. package/cjs/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -39
  21. package/cjs/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -94
  22. package/cjs/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -14
  23. package/cjs/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -9
  24. package/cjs/node_modules/@tanstack/react-query/build/lib/utils.js +0 -12
  25. package/cjs/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  26. package/cjs/node_modules/use-sync-external-store/shim/index.js +0 -13
  27. package/es/_virtual/index.js +0 -3
  28. package/es/_virtual/use-sync-external-store-shim.production.js +0 -3
  29. package/es/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -90
  30. package/es/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -98
  31. package/es/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -92
  32. package/es/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -569
  33. package/es/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -17
  34. package/es/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -31
  35. package/es/node_modules/@tanstack/query-core/build/lib/utils.js +0 -140
  36. package/es/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -42
  37. package/es/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -24
  38. package/es/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -28
  39. package/es/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -9
  40. package/es/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -34
  41. package/es/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -72
  42. package/es/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -12
  43. package/es/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -7
  44. package/es/node_modules/@tanstack/react-query/build/lib/utils.js +0 -10
  45. package/es/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -69
  46. package/es/node_modules/use-sync-external-store/shim/index.js +0 -11
@@ -1,571 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils.js');
4
- var notifyManager = require('./notifyManager.js');
5
- var focusManager = require('./focusManager.js');
6
- var subscribable = require('./subscribable.js');
7
- var retryer = require('./retryer.js');
8
-
9
- class QueryObserver extends subscribable.Subscribable {
10
- constructor(client, options) {
11
- super();
12
- this.client = client;
13
- this.options = options;
14
- this.trackedProps = new Set();
15
- this.selectError = null;
16
- this.bindMethods();
17
- this.setOptions(options);
18
- }
19
-
20
- bindMethods() {
21
- this.remove = this.remove.bind(this);
22
- this.refetch = this.refetch.bind(this);
23
- }
24
-
25
- onSubscribe() {
26
- if (this.listeners.size === 1) {
27
- this.currentQuery.addObserver(this);
28
-
29
- if (shouldFetchOnMount(this.currentQuery, this.options)) {
30
- this.executeFetch();
31
- }
32
-
33
- this.updateTimers();
34
- }
35
- }
36
-
37
- onUnsubscribe() {
38
- if (!this.hasListeners()) {
39
- this.destroy();
40
- }
41
- }
42
-
43
- shouldFetchOnReconnect() {
44
- return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);
45
- }
46
-
47
- shouldFetchOnWindowFocus() {
48
- return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);
49
- }
50
-
51
- destroy() {
52
- this.listeners = new Set();
53
- this.clearStaleTimeout();
54
- this.clearRefetchInterval();
55
- this.currentQuery.removeObserver(this);
56
- }
57
-
58
- setOptions(options, notifyOptions) {
59
- const prevOptions = this.options;
60
- const prevQuery = this.currentQuery;
61
- this.options = this.client.defaultQueryOptions(options);
62
-
63
- if (!utils.shallowEqualObjects(prevOptions, this.options)) {
64
- this.client.getQueryCache().notify({
65
- type: 'observerOptionsUpdated',
66
- query: this.currentQuery,
67
- observer: this
68
- });
69
- }
70
-
71
- if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {
72
- throw new Error('Expected enabled to be a boolean');
73
- } // Keep previous query key if the user does not supply one
74
-
75
-
76
- if (!this.options.queryKey) {
77
- this.options.queryKey = prevOptions.queryKey;
78
- }
79
-
80
- this.updateQuery();
81
- const mounted = this.hasListeners(); // Fetch if there are subscribers
82
-
83
- if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {
84
- this.executeFetch();
85
- } // Update result
86
-
87
-
88
- this.updateResult(notifyOptions); // Update stale interval if needed
89
-
90
- if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
91
- this.updateStaleTimeout();
92
- }
93
-
94
- const nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed
95
-
96
- if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {
97
- this.updateRefetchInterval(nextRefetchInterval);
98
- }
99
- }
100
-
101
- getOptimisticResult(options) {
102
- const query = this.client.getQueryCache().build(this.client, options);
103
- const result = this.createResult(query, options);
104
-
105
- if (shouldAssignObserverCurrentProperties(this, result, options)) {
106
- // this assigns the optimistic result to the current Observer
107
- // because if the query function changes, useQuery will be performing
108
- // an effect where it would fetch again.
109
- // When the fetch finishes, we perform a deep data cloning in order
110
- // to reuse objects references. This deep data clone is performed against
111
- // the `observer.currentResult.data` property
112
- // When QueryKey changes, we refresh the query and get new `optimistic`
113
- // result, while we leave the `observer.currentResult`, so when new data
114
- // arrives, it finds the old `observer.currentResult` which is related
115
- // to the old QueryKey. Which means that currentResult and selectData are
116
- // out of sync already.
117
- // To solve this, we move the cursor of the currentResult everytime
118
- // an observer reads an optimistic value.
119
- // When keeping the previous data, the result doesn't change until new
120
- // data arrives.
121
- this.currentResult = result;
122
- this.currentResultOptions = this.options;
123
- this.currentResultState = this.currentQuery.state;
124
- }
125
-
126
- return result;
127
- }
128
-
129
- getCurrentResult() {
130
- return this.currentResult;
131
- }
132
-
133
- trackResult(result) {
134
- const trackedResult = {};
135
- Object.keys(result).forEach(key => {
136
- Object.defineProperty(trackedResult, key, {
137
- configurable: false,
138
- enumerable: true,
139
- get: () => {
140
- this.trackedProps.add(key);
141
- return result[key];
142
- }
143
- });
144
- });
145
- return trackedResult;
146
- }
147
-
148
- getCurrentQuery() {
149
- return this.currentQuery;
150
- }
151
-
152
- remove() {
153
- this.client.getQueryCache().remove(this.currentQuery);
154
- }
155
-
156
- refetch({
157
- refetchPage,
158
- ...options
159
- } = {}) {
160
- return this.fetch({ ...options,
161
- meta: {
162
- refetchPage
163
- }
164
- });
165
- }
166
-
167
- fetchOptimistic(options) {
168
- const defaultedOptions = this.client.defaultQueryOptions(options);
169
- const query = this.client.getQueryCache().build(this.client, defaultedOptions);
170
- query.isFetchingOptimistic = true;
171
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
172
- }
173
-
174
- fetch(fetchOptions) {
175
- var _fetchOptions$cancelR;
176
-
177
- return this.executeFetch({ ...fetchOptions,
178
- cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true
179
- }).then(() => {
180
- this.updateResult();
181
- return this.currentResult;
182
- });
183
- }
184
-
185
- executeFetch(fetchOptions) {
186
- // Make sure we reference the latest query as the current one might have been removed
187
- this.updateQuery(); // Fetch
188
-
189
- let promise = this.currentQuery.fetch(this.options, fetchOptions);
190
-
191
- if (!(fetchOptions != null && fetchOptions.throwOnError)) {
192
- promise = promise.catch(utils.noop);
193
- }
194
-
195
- return promise;
196
- }
197
-
198
- updateStaleTimeout() {
199
- this.clearStaleTimeout();
200
-
201
- if (utils.isServer || this.currentResult.isStale || !utils.isValidTimeout(this.options.staleTime)) {
202
- return;
203
- }
204
-
205
- const time = utils.timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.
206
- // To mitigate this issue we always add 1 ms to the timeout.
207
-
208
- const timeout = time + 1;
209
- this.staleTimeoutId = setTimeout(() => {
210
- if (!this.currentResult.isStale) {
211
- this.updateResult();
212
- }
213
- }, timeout);
214
- }
215
-
216
- computeRefetchInterval() {
217
- var _this$options$refetch;
218
-
219
- return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;
220
- }
221
-
222
- updateRefetchInterval(nextInterval) {
223
- this.clearRefetchInterval();
224
- this.currentRefetchInterval = nextInterval;
225
-
226
- if (utils.isServer || this.options.enabled === false || !utils.isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {
227
- return;
228
- }
229
-
230
- this.refetchIntervalId = setInterval(() => {
231
- if (this.options.refetchIntervalInBackground || focusManager.focusManager.isFocused()) {
232
- this.executeFetch();
233
- }
234
- }, this.currentRefetchInterval);
235
- }
236
-
237
- updateTimers() {
238
- this.updateStaleTimeout();
239
- this.updateRefetchInterval(this.computeRefetchInterval());
240
- }
241
-
242
- clearStaleTimeout() {
243
- if (this.staleTimeoutId) {
244
- clearTimeout(this.staleTimeoutId);
245
- this.staleTimeoutId = undefined;
246
- }
247
- }
248
-
249
- clearRefetchInterval() {
250
- if (this.refetchIntervalId) {
251
- clearInterval(this.refetchIntervalId);
252
- this.refetchIntervalId = undefined;
253
- }
254
- }
255
-
256
- createResult(query, options) {
257
- const prevQuery = this.currentQuery;
258
- const prevOptions = this.options;
259
- const prevResult = this.currentResult;
260
- const prevResultState = this.currentResultState;
261
- const prevResultOptions = this.currentResultOptions;
262
- const queryChange = query !== prevQuery;
263
- const queryInitialState = queryChange ? query.state : this.currentQueryInitialState;
264
- const prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;
265
- const {
266
- state
267
- } = query;
268
- let {
269
- dataUpdatedAt,
270
- error,
271
- errorUpdatedAt,
272
- fetchStatus,
273
- status
274
- } = state;
275
- let isPreviousData = false;
276
- let isPlaceholderData = false;
277
- let data; // Optimistically set result in fetching state if needed
278
-
279
- if (options._optimisticResults) {
280
- const mounted = this.hasListeners();
281
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
282
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
283
-
284
- if (fetchOnMount || fetchOptionally) {
285
- fetchStatus = retryer.canFetch(query.options.networkMode) ? 'fetching' : 'paused';
286
-
287
- if (!dataUpdatedAt) {
288
- status = 'loading';
289
- }
290
- }
291
-
292
- if (options._optimisticResults === 'isRestoring') {
293
- fetchStatus = 'idle';
294
- }
295
- } // Keep previous data if needed
296
-
297
-
298
- if (options.keepPreviousData && !state.dataUpdatedAt && prevQueryResult != null && prevQueryResult.isSuccess && status !== 'error') {
299
- data = prevQueryResult.data;
300
- dataUpdatedAt = prevQueryResult.dataUpdatedAt;
301
- status = prevQueryResult.status;
302
- isPreviousData = true;
303
- } // Select data if needed
304
- else if (options.select && typeof state.data !== 'undefined') {
305
- // Memoize select result
306
- if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {
307
- data = this.selectResult;
308
- } else {
309
- try {
310
- this.selectFn = options.select;
311
- data = options.select(state.data);
312
- data = utils.replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
313
- this.selectResult = data;
314
- this.selectError = null;
315
- } catch (selectError) {
316
-
317
- this.selectError = selectError;
318
- }
319
- }
320
- } // Use query data
321
- else {
322
- data = state.data;
323
- } // Show placeholder data if needed
324
-
325
-
326
- if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'loading') {
327
- let placeholderData; // Memoize placeholder data
328
-
329
- if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
330
- placeholderData = prevResult.data;
331
- } else {
332
- placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;
333
-
334
- if (options.select && typeof placeholderData !== 'undefined') {
335
- try {
336
- placeholderData = options.select(placeholderData);
337
- this.selectError = null;
338
- } catch (selectError) {
339
-
340
- this.selectError = selectError;
341
- }
342
- }
343
- }
344
-
345
- if (typeof placeholderData !== 'undefined') {
346
- status = 'success';
347
- data = utils.replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
348
- isPlaceholderData = true;
349
- }
350
- }
351
-
352
- if (this.selectError) {
353
- error = this.selectError;
354
- data = this.selectResult;
355
- errorUpdatedAt = Date.now();
356
- status = 'error';
357
- }
358
-
359
- const isFetching = fetchStatus === 'fetching';
360
- const isLoading = status === 'loading';
361
- const isError = status === 'error';
362
- const result = {
363
- status,
364
- fetchStatus,
365
- isLoading,
366
- isSuccess: status === 'success',
367
- isError,
368
- isInitialLoading: isLoading && isFetching,
369
- data,
370
- dataUpdatedAt,
371
- error,
372
- errorUpdatedAt,
373
- failureCount: state.fetchFailureCount,
374
- failureReason: state.fetchFailureReason,
375
- errorUpdateCount: state.errorUpdateCount,
376
- isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
377
- isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
378
- isFetching,
379
- isRefetching: isFetching && !isLoading,
380
- isLoadingError: isError && state.dataUpdatedAt === 0,
381
- isPaused: fetchStatus === 'paused',
382
- isPlaceholderData,
383
- isPreviousData,
384
- isRefetchError: isError && state.dataUpdatedAt !== 0,
385
- isStale: isStale(query, options),
386
- refetch: this.refetch,
387
- remove: this.remove
388
- };
389
- return result;
390
- }
391
-
392
- updateResult(notifyOptions) {
393
- const prevResult = this.currentResult;
394
- const nextResult = this.createResult(this.currentQuery, this.options);
395
- this.currentResultState = this.currentQuery.state;
396
- this.currentResultOptions = this.options; // Only notify and update result if something has changed
397
-
398
- if (utils.shallowEqualObjects(nextResult, prevResult)) {
399
- return;
400
- }
401
-
402
- this.currentResult = nextResult; // Determine which callbacks to trigger
403
-
404
- const defaultNotifyOptions = {
405
- cache: true
406
- };
407
-
408
- const shouldNotifyListeners = () => {
409
- if (!prevResult) {
410
- return true;
411
- }
412
-
413
- const {
414
- notifyOnChangeProps
415
- } = this.options;
416
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === 'function' ? notifyOnChangeProps() : notifyOnChangeProps;
417
-
418
- if (notifyOnChangePropsValue === 'all' || !notifyOnChangePropsValue && !this.trackedProps.size) {
419
- return true;
420
- }
421
-
422
- const includedProps = new Set(notifyOnChangePropsValue != null ? notifyOnChangePropsValue : this.trackedProps);
423
-
424
- if (this.options.useErrorBoundary) {
425
- includedProps.add('error');
426
- }
427
-
428
- return Object.keys(this.currentResult).some(key => {
429
- const typedKey = key;
430
- const changed = this.currentResult[typedKey] !== prevResult[typedKey];
431
- return changed && includedProps.has(typedKey);
432
- });
433
- };
434
-
435
- if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
436
- defaultNotifyOptions.listeners = true;
437
- }
438
-
439
- this.notify({ ...defaultNotifyOptions,
440
- ...notifyOptions
441
- });
442
- }
443
-
444
- updateQuery() {
445
- const query = this.client.getQueryCache().build(this.client, this.options);
446
-
447
- if (query === this.currentQuery) {
448
- return;
449
- }
450
-
451
- const prevQuery = this.currentQuery;
452
- this.currentQuery = query;
453
- this.currentQueryInitialState = query.state;
454
- this.previousQueryResult = this.currentResult;
455
-
456
- if (this.hasListeners()) {
457
- prevQuery == null ? void 0 : prevQuery.removeObserver(this);
458
- query.addObserver(this);
459
- }
460
- }
461
-
462
- onQueryUpdate(action) {
463
- const notifyOptions = {};
464
-
465
- if (action.type === 'success') {
466
- notifyOptions.onSuccess = !action.manual;
467
- } else if (action.type === 'error' && !retryer.isCancelledError(action.error)) {
468
- notifyOptions.onError = true;
469
- }
470
-
471
- this.updateResult(notifyOptions);
472
-
473
- if (this.hasListeners()) {
474
- this.updateTimers();
475
- }
476
- }
477
-
478
- notify(notifyOptions) {
479
- notifyManager.notifyManager.batch(() => {
480
- // First trigger the configuration callbacks
481
- if (notifyOptions.onSuccess) {
482
- var _this$options$onSucce, _this$options, _this$options$onSettl, _this$options2;
483
-
484
- (_this$options$onSucce = (_this$options = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options, this.currentResult.data);
485
- (_this$options$onSettl = (_this$options2 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options2, this.currentResult.data, null);
486
- } else if (notifyOptions.onError) {
487
- var _this$options$onError, _this$options3, _this$options$onSettl2, _this$options4;
488
-
489
- (_this$options$onError = (_this$options3 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options3, this.currentResult.error);
490
- (_this$options$onSettl2 = (_this$options4 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options4, undefined, this.currentResult.error);
491
- } // Then trigger the listeners
492
-
493
-
494
- if (notifyOptions.listeners) {
495
- this.listeners.forEach(({
496
- listener
497
- }) => {
498
- listener(this.currentResult);
499
- });
500
- } // Then the cache listeners
501
-
502
-
503
- if (notifyOptions.cache) {
504
- this.client.getQueryCache().notify({
505
- query: this.currentQuery,
506
- type: 'observerResultsUpdated'
507
- });
508
- }
509
- });
510
- }
511
-
512
- }
513
-
514
- function shouldLoadOnMount(query, options) {
515
- return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);
516
- }
517
-
518
- function shouldFetchOnMount(query, options) {
519
- return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
520
- }
521
-
522
- function shouldFetchOn(query, options, field) {
523
- if (options.enabled !== false) {
524
- const value = typeof field === 'function' ? field(query) : field;
525
- return value === 'always' || value !== false && isStale(query, options);
526
- }
527
-
528
- return false;
529
- }
530
-
531
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
532
- return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);
533
- }
534
-
535
- function isStale(query, options) {
536
- return query.isStaleByTime(options.staleTime);
537
- } // this function would decide if we will update the observer's 'current'
538
- // properties after an optimistic reading via getOptimisticResult
539
-
540
-
541
- function shouldAssignObserverCurrentProperties(observer, optimisticResult, options) {
542
- // it is important to keep this condition like this for three reasons:
543
- // 1. It will get removed in the v5
544
- // 2. it reads: don't update the properties if we want to keep the previous
545
- // data.
546
- // 3. The opposite condition (!options.keepPreviousData) would fallthrough
547
- // and will result in a bad decision
548
- if (options.keepPreviousData) {
549
- return false;
550
- } // this means we want to put some placeholder data when pending and queryKey
551
- // changed.
552
-
553
-
554
- if (options.placeholderData !== undefined) {
555
- // re-assign properties only if current data is placeholder data
556
- // which means that data did not arrive yet, so, if there is some cached data
557
- // we need to "prepare" to receive it
558
- return optimisticResult.isPlaceholderData;
559
- } // if the newly created result isn't what the observer is holding as current,
560
- // then we'll need to update the properties as well
561
-
562
-
563
- if (!utils.shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
564
- return true;
565
- } // basically, just keep previous properties if nothing changed
566
-
567
-
568
- return false;
569
- }
570
-
571
- exports.QueryObserver = QueryObserver;
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var onlineManager = require('./onlineManager.js');
4
-
5
- function canFetch(networkMode) {
6
- return (networkMode != null ? networkMode : 'online') === 'online' ? onlineManager.onlineManager.isOnline() : true;
7
- }
8
- class CancelledError {
9
- constructor(options) {
10
- this.revert = options == null ? void 0 : options.revert;
11
- this.silent = options == null ? void 0 : options.silent;
12
- }
13
-
14
- }
15
- function isCancelledError(value) {
16
- return value instanceof CancelledError;
17
- }
18
-
19
- exports.CancelledError = CancelledError;
20
- exports.canFetch = canFetch;
21
- exports.isCancelledError = isCancelledError;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- class Subscribable {
4
- constructor() {
5
- this.listeners = new Set();
6
- this.subscribe = this.subscribe.bind(this);
7
- }
8
-
9
- subscribe(listener) {
10
- const identity = {
11
- listener
12
- };
13
- this.listeners.add(identity);
14
- this.onSubscribe();
15
- return () => {
16
- this.listeners.delete(identity);
17
- this.onUnsubscribe();
18
- };
19
- }
20
-
21
- hasListeners() {
22
- return this.listeners.size > 0;
23
- }
24
-
25
- onSubscribe() {// Do nothing
26
- }
27
-
28
- onUnsubscribe() {// Do nothing
29
- }
30
-
31
- }
32
-
33
- exports.Subscribable = Subscribable;