@tanstack/react-query 4.29.7 → 4.29.11
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.
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
return typeof value === 'number' && value >= 0 && value !== Infinity;
|
|
72
72
|
}
|
|
73
73
|
function difference(array1, array2) {
|
|
74
|
-
return array1.filter(x => array2.
|
|
74
|
+
return array1.filter(x => !array2.includes(x));
|
|
75
75
|
}
|
|
76
76
|
function replaceAt(array, index, value) {
|
|
77
77
|
const copy = array.slice(0);
|
|
@@ -461,6 +461,7 @@
|
|
|
461
461
|
}
|
|
462
462
|
const focusManager = new FocusManager();
|
|
463
463
|
|
|
464
|
+
const onlineEvents = ['online', 'offline'];
|
|
464
465
|
class OnlineManager extends Subscribable {
|
|
465
466
|
constructor() {
|
|
466
467
|
super();
|
|
@@ -472,12 +473,14 @@
|
|
|
472
473
|
const listener = () => onOnline(); // Listen to online
|
|
473
474
|
|
|
474
475
|
|
|
475
|
-
|
|
476
|
-
|
|
476
|
+
onlineEvents.forEach(event => {
|
|
477
|
+
window.addEventListener(event, listener, false);
|
|
478
|
+
});
|
|
477
479
|
return () => {
|
|
478
480
|
// Be sure to unsubscribe if a new handler is set
|
|
479
|
-
|
|
480
|
-
|
|
481
|
+
onlineEvents.forEach(event => {
|
|
482
|
+
window.removeEventListener(event, listener);
|
|
483
|
+
});
|
|
481
484
|
};
|
|
482
485
|
}
|
|
483
486
|
|
|
@@ -953,7 +956,7 @@
|
|
|
953
956
|
}
|
|
954
957
|
|
|
955
958
|
addObserver(observer) {
|
|
956
|
-
if (this.observers.
|
|
959
|
+
if (!this.observers.includes(observer)) {
|
|
957
960
|
this.observers.push(observer); // Stop the query from being garbage collected
|
|
958
961
|
|
|
959
962
|
this.clearGcTimeout();
|
|
@@ -966,7 +969,7 @@
|
|
|
966
969
|
}
|
|
967
970
|
|
|
968
971
|
removeObserver(observer) {
|
|
969
|
-
if (this.observers.
|
|
972
|
+
if (this.observers.includes(observer)) {
|
|
970
973
|
this.observers = this.observers.filter(x => x !== observer);
|
|
971
974
|
|
|
972
975
|
if (!this.observers.length) {
|
|
@@ -1451,7 +1454,7 @@
|
|
|
1451
1454
|
}
|
|
1452
1455
|
|
|
1453
1456
|
addObserver(observer) {
|
|
1454
|
-
if (this.observers.
|
|
1457
|
+
if (!this.observers.includes(observer)) {
|
|
1455
1458
|
this.observers.push(observer); // Stop the mutation from being garbage collected
|
|
1456
1459
|
|
|
1457
1460
|
this.clearGcTimeout();
|