@legendapp/state 3.0.0-beta.18 → 3.0.0-beta.19

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/index.d.mts CHANGED
@@ -153,6 +153,7 @@ type ObservableListenerDispose = () => void;
153
153
  interface ObservableRoot {
154
154
  _: any;
155
155
  set?: (value: any) => void;
156
+ isLoadingLocal?: boolean;
156
157
  }
157
158
  type Primitive = boolean | string | number | Date;
158
159
  type NotPrimitive<T> = T extends Primitive ? never : T;
package/index.d.ts CHANGED
@@ -153,6 +153,7 @@ type ObservableListenerDispose = () => void;
153
153
  interface ObservableRoot {
154
154
  _: any;
155
155
  set?: (value: any) => void;
156
+ isLoadingLocal?: boolean;
156
157
  }
157
158
  type Primitive = boolean | string | number | Date;
158
159
  type NotPrimitive<T> = T extends Primitive ? never : T;
package/index.js CHANGED
@@ -1842,7 +1842,7 @@ function peekInternal(node, activateRecursive) {
1842
1842
  if (((_b = node.parent) == null ? void 0 : _b.isPlain) || isHintPlain(value)) {
1843
1843
  node.isPlain = true;
1844
1844
  }
1845
- if (!globalState.isLoadingLocal && !node.isPlain) {
1845
+ if (!node.root.isLoadingLocal && !node.isPlain) {
1846
1846
  value = checkLazy(node, value, !!activateRecursive);
1847
1847
  }
1848
1848
  return value;
package/index.mjs CHANGED
@@ -1840,7 +1840,7 @@ function peekInternal(node, activateRecursive) {
1840
1840
  if (((_b = node.parent) == null ? void 0 : _b.isPlain) || isHintPlain(value)) {
1841
1841
  node.isPlain = true;
1842
1842
  }
1843
- if (!globalState.isLoadingLocal && !node.isPlain) {
1843
+ if (!node.root.isLoadingLocal && !node.isPlain) {
1844
1844
  value = checkLazy(node, value, !!activateRecursive);
1845
1845
  }
1846
1846
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/state",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "legend-state",
5
5
  "sideEffects": false,
6
6
  "private": false,
package/sync.js CHANGED
@@ -816,12 +816,14 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
816
816
  if (state.isPromise(value)) {
817
817
  value = await value;
818
818
  }
819
+ node.root.isLoadingLocal = true;
819
820
  state.internal.globalState.isLoadingLocal = true;
820
821
  if (value === null && (!prevValue || prevValue[symbolLinked])) {
821
822
  value$.set(value);
822
823
  } else {
823
824
  state.mergeIntoObservable(value$, value);
824
825
  }
826
+ node.root.isLoadingLocal = false;
825
827
  state.internal.globalState.isLoadingLocal = false;
826
828
  }
827
829
  syncStateValue.numPendingLocalLoads--;
package/sync.mjs CHANGED
@@ -814,12 +814,14 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
814
814
  if (isPromise$1(value)) {
815
815
  value = await value;
816
816
  }
817
+ node.root.isLoadingLocal = true;
817
818
  internal.globalState.isLoadingLocal = true;
818
819
  if (value === null && (!prevValue || prevValue[symbolLinked])) {
819
820
  value$.set(value);
820
821
  } else {
821
822
  mergeIntoObservable(value$, value);
822
823
  }
824
+ node.root.isLoadingLocal = false;
823
825
  internal.globalState.isLoadingLocal = false;
824
826
  }
825
827
  syncStateValue.numPendingLocalLoads--;