@tanstack/react-query 4.20.4 → 4.21.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.
@@ -1879,6 +1879,7 @@
1879
1879
  this.defaultOptions = config.defaultOptions || {};
1880
1880
  this.queryDefaults = [];
1881
1881
  this.mutationDefaults = [];
1882
+ this.mountCount = 0;
1882
1883
 
1883
1884
  if (config.logger) {
1884
1885
  this.logger.error("Passing a custom logger has been deprecated and will be removed in the next major version.");
@@ -1886,6 +1887,8 @@
1886
1887
  }
1887
1888
 
1888
1889
  mount() {
1890
+ this.mountCount++;
1891
+ if (this.mountCount !== 1) return;
1889
1892
  this.unsubscribeFocus = focusManager.subscribe(() => {
1890
1893
  if (focusManager.isFocused()) {
1891
1894
  this.resumePausedMutations();
@@ -1903,8 +1906,12 @@
1903
1906
  unmount() {
1904
1907
  var _this$unsubscribeFocu, _this$unsubscribeOnli;
1905
1908
 
1909
+ this.mountCount--;
1910
+ if (this.mountCount !== 0) return;
1906
1911
  (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);
1912
+ this.unsubscribeFocus = undefined;
1907
1913
  (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);
1914
+ this.unsubscribeOnline = undefined;
1908
1915
  }
1909
1916
 
1910
1917
  isFetching(arg1, arg2) {