@legendapp/state 3.0.0-alpha.38 → 3.0.0-alpha.39

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/sync.js CHANGED
@@ -709,7 +709,7 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
709
709
  const node = getNode(value$);
710
710
  const nodeValue = getNodeValue(getNode(node.state));
711
711
  const syncStateValue = syncState$.peek();
712
- const prevClearPersist = nodeValue.clearPersist;
712
+ const prevResetPersistence = nodeValue.resetPersistence;
713
713
  if (persist == null ? void 0 : persist.name) {
714
714
  const PersistPlugin = persist.plugin || ((_a = observableSyncConfiguration.persist) == null ? void 0 : _a.plugin);
715
715
  const { table, config } = parseLocalConfig(persist);
@@ -766,16 +766,17 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
766
766
  state.internal.globalState.isLoadingLocal = false;
767
767
  }
768
768
  syncStateValue.numPendingLocalLoads--;
769
- nodeValue.clearPersist = () => Promise.all(
769
+ nodeValue.resetPersistence = () => Promise.all(
770
770
  [
771
- prevClearPersist,
771
+ prevResetPersistence,
772
772
  persistPlugin.deleteTable(table, config),
773
773
  persistPlugin.deleteMetadata(table, config)
774
774
  ].filter(Boolean)
775
775
  );
776
776
  } else {
777
- nodeValue.clearPersist = () => prevClearPersist == null ? void 0 : prevClearPersist();
777
+ nodeValue.resetPersistence = () => prevResetPersistence == null ? void 0 : prevResetPersistence();
778
778
  }
779
+ nodeValue.clearPersist = nodeValue.resetPersistence;
779
780
  syncState$.isPersistLoaded.set(!(syncStateValue.numPendingLocalLoads > 0));
780
781
  }
781
782
  function syncObservable(obs$, syncOptionsOrSynced) {
@@ -1003,7 +1004,7 @@ function syncObservable(obs$, syncOptionsOrSynced) {
1003
1004
  var _a3;
1004
1005
  modeBeforeReset = getParams.mode;
1005
1006
  getParams.mode = "set";
1006
- return (_a3 = syncStateValue.clearPersist) == null ? void 0 : _a3.call(syncStateValue);
1007
+ return (_a3 = syncStateValue.resetPersistence) == null ? void 0 : _a3.call(syncStateValue);
1007
1008
  },
1008
1009
  cancel: false
1009
1010
  };
@@ -1101,7 +1102,7 @@ function syncObservable(obs$, syncOptionsOrSynced) {
1101
1102
  isSubscribed = false;
1102
1103
  unsubscribe == null ? void 0 : unsubscribe();
1103
1104
  unsubscribe = void 0;
1104
- const promise = syncStateValue.clearPersist();
1105
+ const promise = syncStateValue.resetPersistence();
1105
1106
  onChangeRemote(() => {
1106
1107
  var _a;
1107
1108
  obs$.set((_a = syncOptions.initial) != null ? _a : void 0);
package/sync.mjs CHANGED
@@ -707,7 +707,7 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
707
707
  const node = getNode(value$);
708
708
  const nodeValue = getNodeValue(getNode(node.state));
709
709
  const syncStateValue = syncState$.peek();
710
- const prevClearPersist = nodeValue.clearPersist;
710
+ const prevResetPersistence = nodeValue.resetPersistence;
711
711
  if (persist == null ? void 0 : persist.name) {
712
712
  const PersistPlugin = persist.plugin || ((_a = observableSyncConfiguration.persist) == null ? void 0 : _a.plugin);
713
713
  const { table, config } = parseLocalConfig(persist);
@@ -764,16 +764,17 @@ async function loadLocal(value$, syncOptions, syncState$, localState) {
764
764
  internal.globalState.isLoadingLocal = false;
765
765
  }
766
766
  syncStateValue.numPendingLocalLoads--;
767
- nodeValue.clearPersist = () => Promise.all(
767
+ nodeValue.resetPersistence = () => Promise.all(
768
768
  [
769
- prevClearPersist,
769
+ prevResetPersistence,
770
770
  persistPlugin.deleteTable(table, config),
771
771
  persistPlugin.deleteMetadata(table, config)
772
772
  ].filter(Boolean)
773
773
  );
774
774
  } else {
775
- nodeValue.clearPersist = () => prevClearPersist == null ? void 0 : prevClearPersist();
775
+ nodeValue.resetPersistence = () => prevResetPersistence == null ? void 0 : prevResetPersistence();
776
776
  }
777
+ nodeValue.clearPersist = nodeValue.resetPersistence;
777
778
  syncState$.isPersistLoaded.set(!(syncStateValue.numPendingLocalLoads > 0));
778
779
  }
779
780
  function syncObservable(obs$, syncOptionsOrSynced) {
@@ -1001,7 +1002,7 @@ function syncObservable(obs$, syncOptionsOrSynced) {
1001
1002
  var _a3;
1002
1003
  modeBeforeReset = getParams.mode;
1003
1004
  getParams.mode = "set";
1004
- return (_a3 = syncStateValue.clearPersist) == null ? void 0 : _a3.call(syncStateValue);
1005
+ return (_a3 = syncStateValue.resetPersistence) == null ? void 0 : _a3.call(syncStateValue);
1005
1006
  },
1006
1007
  cancel: false
1007
1008
  };
@@ -1099,7 +1100,7 @@ function syncObservable(obs$, syncOptionsOrSynced) {
1099
1100
  isSubscribed = false;
1100
1101
  unsubscribe == null ? void 0 : unsubscribe();
1101
1102
  unsubscribe = void 0;
1102
- const promise = syncStateValue.clearPersist();
1103
+ const promise = syncStateValue.resetPersistence();
1103
1104
  onChangeRemote(() => {
1104
1105
  var _a;
1105
1106
  obs$.set((_a = syncOptions.initial) != null ? _a : void 0);