@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/.DS_Store +0 -0
- package/{config.d.ts → config/configureLegendState.d.mts} +1 -1
- package/{config.d.mts → config/configureLegendState.d.ts} +1 -1
- package/config/configureLegendState.js +45 -0
- package/config/configureLegendState.mjs +43 -0
- package/config/enable$GetSet.js +2 -2
- package/config/enable$GetSet.mjs +1 -1
- package/config/enableReactTracking.js +2 -2
- package/config/enableReactTracking.mjs +1 -1
- package/config/enableReactUse.js +2 -2
- package/config/enableReactUse.mjs +1 -1
- package/config/enable_PeekAssign.js +2 -2
- package/config/enable_PeekAssign.mjs +1 -1
- package/index.d.mts +298 -3
- package/index.d.ts +298 -3
- package/index.js +6 -2
- package/index.mjs +6 -2
- package/package.json +6 -6
- package/react-reactive/enableReactive.d.mts +1 -3
- package/react-reactive/enableReactive.d.ts +1 -3
- package/react.d.mts +30 -4
- package/react.d.ts +30 -4
- package/react.js +3 -1
- package/react.mjs +3 -1
- package/sync-plugins/tanstack-query.js +12 -6
- package/sync-plugins/tanstack-query.mjs +12 -6
- package/sync-plugins/tanstack-react-query.js +8 -1
- package/sync-plugins/tanstack-react-query.mjs +8 -1
- package/sync.js +7 -6
- package/sync.mjs +7 -6
- package/config.js +0 -2072
- package/config.mjs +0 -2070
- package/configureReactive-BAV1PS2I.d.mts +0 -32
- package/configureReactive-BAV1PS2I.d.ts +0 -32
- package/observableInterfaces-CgBddSU6.d.mts +0 -287
- package/observableInterfaces-CgBddSU6.d.ts +0 -287
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
|
|
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.
|
|
769
|
+
nodeValue.resetPersistence = () => Promise.all(
|
|
770
770
|
[
|
|
771
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
767
|
+
nodeValue.resetPersistence = () => Promise.all(
|
|
768
768
|
[
|
|
769
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
1103
|
+
const promise = syncStateValue.resetPersistence();
|
|
1103
1104
|
onChangeRemote(() => {
|
|
1104
1105
|
var _a;
|
|
1105
1106
|
obs$.set((_a = syncOptions.initial) != null ? _a : void 0);
|