dara-core 1.13.1__py3-none-any.whl → 1.14.0a0__py3-none-any.whl
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.
- dara/core/auth/base.py +10 -1
- dara/core/auth/routes.py +51 -1
- dara/core/umd/dara.core.umd.js +490 -415
- {dara_core-1.13.1.dist-info → dara_core-1.14.0a0.dist-info}/METADATA +10 -10
- {dara_core-1.13.1.dist-info → dara_core-1.14.0a0.dist-info}/RECORD +8 -8
- {dara_core-1.13.1.dist-info → dara_core-1.14.0a0.dist-info}/LICENSE +0 -0
- {dara_core-1.13.1.dist-info → dara_core-1.14.0a0.dist-info}/WHEEL +0 -0
- {dara_core-1.13.1.dist-info → dara_core-1.14.0a0.dist-info}/entry_points.txt +0 -0
dara/core/umd/dara.core.umd.js
CHANGED
|
@@ -30,10 +30,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
30
30
|
return __privateGet(obj, member, getter);
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
+
var __privateMethod = (obj, member, method) => {
|
|
34
|
+
__accessCheck(obj, member, "access private method");
|
|
35
|
+
return method;
|
|
36
|
+
};
|
|
33
37
|
(function(global2, factory) {
|
|
34
38
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tanstack/react-query"), require("react-dom"), require("styled-components")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tanstack/react-query", "react-dom", "styled-components"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.dara = global2.dara || {}, global2.dara.core = {}), global2.React, global2.ReactQuery, global2.ReactDOM, global2.styled));
|
|
35
39
|
})(this, function(exports, React, reactQuery, ReactDOM, styled) {
|
|
36
|
-
var _pingInterval, _socketUrl, _reconnectCount, _events$, _parentBus, _instance, _observers;
|
|
40
|
+
var _state, _locks, _subscribers, _notify, notify_fn, _pingInterval, _socketUrl, _reconnectCount, _events$, _parentBus, _instance, _observers;
|
|
37
41
|
"use strict";
|
|
38
42
|
const _interopDefaultLegacy = (e3) => e3 && typeof e3 === "object" && "default" in e3 ? e3 : { default: e3 };
|
|
39
43
|
function _interopNamespace(e3) {
|
|
@@ -3381,22 +3385,22 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3381
3385
|
}
|
|
3382
3386
|
}
|
|
3383
3387
|
}
|
|
3384
|
-
function saveDepsToStore(key, deps,
|
|
3388
|
+
function saveDepsToStore(key, deps, store2, version) {
|
|
3385
3389
|
var _storeState$nextTree, _storeState$previousT, _storeState$previousT2, _storeState$previousT3;
|
|
3386
|
-
const storeState =
|
|
3390
|
+
const storeState = store2.getState();
|
|
3387
3391
|
if (!(version === storeState.currentTree.version || version === ((_storeState$nextTree = storeState.nextTree) === null || _storeState$nextTree === void 0 ? void 0 : _storeState$nextTree.version) || version === ((_storeState$previousT = storeState.previousTree) === null || _storeState$previousT === void 0 ? void 0 : _storeState$previousT.version)))
|
|
3388
3392
|
;
|
|
3389
|
-
const graph2 =
|
|
3393
|
+
const graph2 = store2.getGraph(version);
|
|
3390
3394
|
mergeDepsIntoGraph(key, deps, graph2);
|
|
3391
3395
|
if (version === ((_storeState$previousT2 = storeState.previousTree) === null || _storeState$previousT2 === void 0 ? void 0 : _storeState$previousT2.version)) {
|
|
3392
|
-
const currentGraph =
|
|
3396
|
+
const currentGraph = store2.getGraph(storeState.currentTree.version);
|
|
3393
3397
|
mergeDepsIntoGraph(key, deps, currentGraph, graph2);
|
|
3394
3398
|
}
|
|
3395
3399
|
if (version === ((_storeState$previousT3 = storeState.previousTree) === null || _storeState$previousT3 === void 0 ? void 0 : _storeState$previousT3.version) || version === storeState.currentTree.version) {
|
|
3396
3400
|
var _storeState$nextTree2;
|
|
3397
3401
|
const nextVersion = (_storeState$nextTree2 = storeState.nextTree) === null || _storeState$nextTree2 === void 0 ? void 0 : _storeState$nextTree2.version;
|
|
3398
3402
|
if (nextVersion !== void 0) {
|
|
3399
|
-
const nextGraph =
|
|
3403
|
+
const nextGraph = store2.getGraph(nextVersion);
|
|
3400
3404
|
mergeDepsIntoGraph(key, deps, nextGraph, graph2);
|
|
3401
3405
|
}
|
|
3402
3406
|
}
|
|
@@ -3550,13 +3554,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3550
3554
|
const emptySet = Object.freeze(/* @__PURE__ */ new Set());
|
|
3551
3555
|
class ReadOnlyRecoilValueError extends Error {
|
|
3552
3556
|
}
|
|
3553
|
-
function initializeRetentionForNode(
|
|
3557
|
+
function initializeRetentionForNode(store2, nodeKey, retainedBy) {
|
|
3554
3558
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
3555
3559
|
return () => void 0;
|
|
3556
3560
|
}
|
|
3557
3561
|
const {
|
|
3558
3562
|
nodesRetainedByZone: nodesRetainedByZone2
|
|
3559
|
-
} =
|
|
3563
|
+
} = store2.getState().retention;
|
|
3560
3564
|
function addToZone(zone) {
|
|
3561
3565
|
let set2 = nodesRetainedByZone2.get(zone);
|
|
3562
3566
|
if (!set2) {
|
|
@@ -3577,7 +3581,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3577
3581
|
}
|
|
3578
3582
|
const {
|
|
3579
3583
|
retention
|
|
3580
|
-
} =
|
|
3584
|
+
} = store2.getState();
|
|
3581
3585
|
function deleteFromZone(zone) {
|
|
3582
3586
|
const set2 = retention.nodesRetainedByZone.get(zone);
|
|
3583
3587
|
set2 === null || set2 === void 0 ? void 0 : set2.delete(nodeKey);
|
|
@@ -3594,34 +3598,34 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3594
3598
|
}
|
|
3595
3599
|
};
|
|
3596
3600
|
}
|
|
3597
|
-
function initializeNodeIfNewToStore(
|
|
3598
|
-
const storeState =
|
|
3601
|
+
function initializeNodeIfNewToStore(store2, treeState, key, trigger) {
|
|
3602
|
+
const storeState = store2.getState();
|
|
3599
3603
|
if (storeState.nodeCleanupFunctions.has(key)) {
|
|
3600
3604
|
return;
|
|
3601
3605
|
}
|
|
3602
3606
|
const node = getNode$1(key);
|
|
3603
|
-
const retentionCleanup = initializeRetentionForNode(
|
|
3604
|
-
const nodeCleanup = node.init(
|
|
3607
|
+
const retentionCleanup = initializeRetentionForNode(store2, key, node.retainedBy);
|
|
3608
|
+
const nodeCleanup = node.init(store2, treeState, trigger);
|
|
3605
3609
|
storeState.nodeCleanupFunctions.set(key, () => {
|
|
3606
3610
|
nodeCleanup();
|
|
3607
3611
|
retentionCleanup();
|
|
3608
3612
|
});
|
|
3609
3613
|
}
|
|
3610
|
-
function initializeNode(
|
|
3611
|
-
initializeNodeIfNewToStore(
|
|
3614
|
+
function initializeNode(store2, key, trigger) {
|
|
3615
|
+
initializeNodeIfNewToStore(store2, store2.getState().currentTree, key, trigger);
|
|
3612
3616
|
}
|
|
3613
|
-
function cleanUpNode(
|
|
3617
|
+
function cleanUpNode(store2, key) {
|
|
3614
3618
|
var _state$nodeCleanupFun;
|
|
3615
|
-
const state =
|
|
3619
|
+
const state = store2.getState();
|
|
3616
3620
|
(_state$nodeCleanupFun = state.nodeCleanupFunctions.get(key)) === null || _state$nodeCleanupFun === void 0 ? void 0 : _state$nodeCleanupFun();
|
|
3617
3621
|
state.nodeCleanupFunctions.delete(key);
|
|
3618
3622
|
}
|
|
3619
|
-
function getNodeLoadable(
|
|
3620
|
-
initializeNodeIfNewToStore(
|
|
3621
|
-
return getNode$1(key).get(
|
|
3623
|
+
function getNodeLoadable(store2, state, key) {
|
|
3624
|
+
initializeNodeIfNewToStore(store2, state, key, "get");
|
|
3625
|
+
return getNode$1(key).get(store2, state);
|
|
3622
3626
|
}
|
|
3623
|
-
function peekNodeLoadable(
|
|
3624
|
-
return getNode$1(key).peek(
|
|
3627
|
+
function peekNodeLoadable(store2, state, key) {
|
|
3628
|
+
return getNode$1(key).peek(store2, state);
|
|
3625
3629
|
}
|
|
3626
3630
|
function setUnvalidatedAtomValue_DEPRECATED(state, key, newValue) {
|
|
3627
3631
|
var _node$invalidate;
|
|
@@ -3634,23 +3638,23 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3634
3638
|
dirtyAtoms: setByAddingToSet$1(state.dirtyAtoms, key)
|
|
3635
3639
|
};
|
|
3636
3640
|
}
|
|
3637
|
-
function setNodeValue(
|
|
3641
|
+
function setNodeValue(store2, state, key, newValue) {
|
|
3638
3642
|
const node = getNode$1(key);
|
|
3639
3643
|
if (node.set == null) {
|
|
3640
3644
|
throw new ReadOnlyRecoilValueError(`Attempt to set read-only RecoilValue: ${key}`);
|
|
3641
3645
|
}
|
|
3642
3646
|
const set2 = node.set;
|
|
3643
|
-
initializeNodeIfNewToStore(
|
|
3644
|
-
return set2(
|
|
3647
|
+
initializeNodeIfNewToStore(store2, state, key, "set");
|
|
3648
|
+
return set2(store2, state, newValue);
|
|
3645
3649
|
}
|
|
3646
|
-
function peekNodeInfo(
|
|
3647
|
-
const storeState =
|
|
3648
|
-
const graph2 =
|
|
3650
|
+
function peekNodeInfo(store2, state, key) {
|
|
3651
|
+
const storeState = store2.getState();
|
|
3652
|
+
const graph2 = store2.getGraph(state.version);
|
|
3649
3653
|
const type = getNode$1(key).nodeType;
|
|
3650
3654
|
return Recoil_lazyProxy$1({
|
|
3651
3655
|
type
|
|
3652
3656
|
}, {
|
|
3653
|
-
loadable: () => peekNodeLoadable(
|
|
3657
|
+
loadable: () => peekNodeLoadable(store2, state, key),
|
|
3654
3658
|
isActive: () => storeState.knownAtoms.has(key) || storeState.knownSelectors.has(key),
|
|
3655
3659
|
isSet: () => type === "selector" ? false : state.atomValues.has(key),
|
|
3656
3660
|
isModified: () => state.dirtyAtoms.has(key),
|
|
@@ -3661,7 +3665,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3661
3665
|
subscribers: () => {
|
|
3662
3666
|
var _storeState$nodeToCom, _storeState$nodeToCom2;
|
|
3663
3667
|
return {
|
|
3664
|
-
nodes: recoilValuesForKeys$1(Recoil_filterIterable(getDownstreamNodes(
|
|
3668
|
+
nodes: recoilValuesForKeys$1(Recoil_filterIterable(getDownstreamNodes(store2, state, /* @__PURE__ */ new Set([key])), (nodeKey) => nodeKey !== key)),
|
|
3665
3669
|
components: Recoil_mapIterable((_storeState$nodeToCom = (_storeState$nodeToCom2 = storeState.nodeToComponentSubscriptions.get(key)) === null || _storeState$nodeToCom2 === void 0 ? void 0 : _storeState$nodeToCom2.values()) !== null && _storeState$nodeToCom !== void 0 ? _storeState$nodeToCom : [], ([name]) => ({
|
|
3666
3670
|
name
|
|
3667
3671
|
}))
|
|
@@ -3669,10 +3673,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3669
3673
|
}
|
|
3670
3674
|
});
|
|
3671
3675
|
}
|
|
3672
|
-
function getDownstreamNodes(
|
|
3676
|
+
function getDownstreamNodes(store2, state, keys2) {
|
|
3673
3677
|
const visitedNodes = /* @__PURE__ */ new Set();
|
|
3674
3678
|
const visitingNodes = Array.from(keys2);
|
|
3675
|
-
const graph2 =
|
|
3679
|
+
const graph2 = store2.getGraph(state.version);
|
|
3676
3680
|
for (let key = visitingNodes.pop(); key; key = visitingNodes.pop()) {
|
|
3677
3681
|
var _graph$nodeToNodeSubs;
|
|
3678
3682
|
visitedNodes.add(key);
|
|
@@ -3734,14 +3738,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3734
3738
|
const {
|
|
3735
3739
|
invalidateMemoizedSnapshot: invalidateMemoizedSnapshot$1
|
|
3736
3740
|
} = Recoil_SnapshotCache;
|
|
3737
|
-
function getRecoilValueAsLoadable(
|
|
3741
|
+
function getRecoilValueAsLoadable(store2, {
|
|
3738
3742
|
key
|
|
3739
|
-
}, treeState =
|
|
3743
|
+
}, treeState = store2.getState().currentTree) {
|
|
3740
3744
|
var _storeState$nextTree, _storeState$previousT;
|
|
3741
|
-
const storeState =
|
|
3745
|
+
const storeState = store2.getState();
|
|
3742
3746
|
if (!(treeState.version === storeState.currentTree.version || treeState.version === ((_storeState$nextTree = storeState.nextTree) === null || _storeState$nextTree === void 0 ? void 0 : _storeState$nextTree.version) || treeState.version === ((_storeState$previousT = storeState.previousTree) === null || _storeState$previousT === void 0 ? void 0 : _storeState$previousT.version)))
|
|
3743
3747
|
;
|
|
3744
|
-
const loadable = getNodeLoadable$1(
|
|
3748
|
+
const loadable = getNodeLoadable$1(store2, treeState, key);
|
|
3745
3749
|
if (loadable.state === "loading") {
|
|
3746
3750
|
loadable.contents.catch(() => {
|
|
3747
3751
|
return;
|
|
@@ -3760,11 +3764,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3760
3764
|
});
|
|
3761
3765
|
return result;
|
|
3762
3766
|
}
|
|
3763
|
-
function valueFromValueOrUpdater(
|
|
3767
|
+
function valueFromValueOrUpdater(store2, state, {
|
|
3764
3768
|
key
|
|
3765
3769
|
}, valueOrUpdater) {
|
|
3766
3770
|
if (typeof valueOrUpdater === "function") {
|
|
3767
|
-
const current = getNodeLoadable$1(
|
|
3771
|
+
const current = getNodeLoadable$1(store2, state, key);
|
|
3768
3772
|
if (current.state === "loading") {
|
|
3769
3773
|
const msg = `Tried to set atom or selector "${key}" using an updater function while the current state is pending, this is not currently supported.`;
|
|
3770
3774
|
throw Recoil_err$2(msg);
|
|
@@ -3776,14 +3780,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3776
3780
|
return valueOrUpdater;
|
|
3777
3781
|
}
|
|
3778
3782
|
}
|
|
3779
|
-
function applyAction(
|
|
3783
|
+
function applyAction(store2, state, action) {
|
|
3780
3784
|
if (action.type === "set") {
|
|
3781
3785
|
const {
|
|
3782
3786
|
recoilValue,
|
|
3783
3787
|
valueOrUpdater
|
|
3784
3788
|
} = action;
|
|
3785
|
-
const newValue = valueFromValueOrUpdater(
|
|
3786
|
-
const writes = setNodeValue$1(
|
|
3789
|
+
const newValue = valueFromValueOrUpdater(store2, state, recoilValue, valueOrUpdater);
|
|
3790
|
+
const writes = setNodeValue$1(store2, state, recoilValue.key, newValue);
|
|
3787
3791
|
for (const [key, loadable] of writes.entries()) {
|
|
3788
3792
|
writeLoadableToTreeState(state, key, loadable);
|
|
3789
3793
|
}
|
|
@@ -3828,27 +3832,27 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3828
3832
|
state.dirtyAtoms.add(key);
|
|
3829
3833
|
state.nonvalidatedAtoms.delete(key);
|
|
3830
3834
|
}
|
|
3831
|
-
function applyActionsToStore(
|
|
3832
|
-
|
|
3835
|
+
function applyActionsToStore(store2, actions) {
|
|
3836
|
+
store2.replaceState((state) => {
|
|
3833
3837
|
const newState = copyTreeState(state);
|
|
3834
3838
|
for (const action of actions) {
|
|
3835
|
-
applyAction(
|
|
3839
|
+
applyAction(store2, newState, action);
|
|
3836
3840
|
}
|
|
3837
|
-
invalidateDownstreams(
|
|
3841
|
+
invalidateDownstreams(store2, newState);
|
|
3838
3842
|
invalidateMemoizedSnapshot$1();
|
|
3839
3843
|
return newState;
|
|
3840
3844
|
});
|
|
3841
3845
|
}
|
|
3842
|
-
function queueOrPerformStateUpdate(
|
|
3846
|
+
function queueOrPerformStateUpdate(store2, action) {
|
|
3843
3847
|
if (batchStack.length) {
|
|
3844
3848
|
const actionsByStore = batchStack[batchStack.length - 1];
|
|
3845
|
-
let actions = actionsByStore.get(
|
|
3849
|
+
let actions = actionsByStore.get(store2);
|
|
3846
3850
|
if (!actions) {
|
|
3847
|
-
actionsByStore.set(
|
|
3851
|
+
actionsByStore.set(store2, actions = []);
|
|
3848
3852
|
}
|
|
3849
3853
|
actions.push(action);
|
|
3850
3854
|
} else {
|
|
3851
|
-
applyActionsToStore(
|
|
3855
|
+
applyActionsToStore(store2, [action]);
|
|
3852
3856
|
}
|
|
3853
3857
|
}
|
|
3854
3858
|
const batchStack = [];
|
|
@@ -3856,8 +3860,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3856
3860
|
const actionsByStore = /* @__PURE__ */ new Map();
|
|
3857
3861
|
batchStack.push(actionsByStore);
|
|
3858
3862
|
return () => {
|
|
3859
|
-
for (const [
|
|
3860
|
-
applyActionsToStore(
|
|
3863
|
+
for (const [store2, actions] of actionsByStore) {
|
|
3864
|
+
applyActionsToStore(store2, actions);
|
|
3861
3865
|
}
|
|
3862
3866
|
batchStack.pop();
|
|
3863
3867
|
};
|
|
@@ -3870,62 +3874,62 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3870
3874
|
dirtyAtoms: new Set(state.dirtyAtoms)
|
|
3871
3875
|
};
|
|
3872
3876
|
}
|
|
3873
|
-
function invalidateDownstreams(
|
|
3874
|
-
const downstreams = getDownstreamNodes$1(
|
|
3877
|
+
function invalidateDownstreams(store2, state) {
|
|
3878
|
+
const downstreams = getDownstreamNodes$1(store2, state, state.dirtyAtoms);
|
|
3875
3879
|
for (const key of downstreams) {
|
|
3876
3880
|
var _getNodeMaybe, _getNodeMaybe$invalid;
|
|
3877
3881
|
(_getNodeMaybe = getNodeMaybe$2(key)) === null || _getNodeMaybe === void 0 ? void 0 : (_getNodeMaybe$invalid = _getNodeMaybe.invalidate) === null || _getNodeMaybe$invalid === void 0 ? void 0 : _getNodeMaybe$invalid.call(_getNodeMaybe, state);
|
|
3878
3882
|
}
|
|
3879
3883
|
}
|
|
3880
|
-
function setRecoilValue(
|
|
3881
|
-
queueOrPerformStateUpdate(
|
|
3884
|
+
function setRecoilValue(store2, recoilValue, valueOrUpdater) {
|
|
3885
|
+
queueOrPerformStateUpdate(store2, {
|
|
3882
3886
|
type: "set",
|
|
3883
3887
|
recoilValue,
|
|
3884
3888
|
valueOrUpdater
|
|
3885
3889
|
});
|
|
3886
3890
|
}
|
|
3887
|
-
function setRecoilValueLoadable(
|
|
3891
|
+
function setRecoilValueLoadable(store2, recoilValue, loadable) {
|
|
3888
3892
|
if (loadable instanceof DefaultValue$1$1) {
|
|
3889
|
-
return setRecoilValue(
|
|
3893
|
+
return setRecoilValue(store2, recoilValue, loadable);
|
|
3890
3894
|
}
|
|
3891
|
-
queueOrPerformStateUpdate(
|
|
3895
|
+
queueOrPerformStateUpdate(store2, {
|
|
3892
3896
|
type: "setLoadable",
|
|
3893
3897
|
recoilValue,
|
|
3894
3898
|
loadable
|
|
3895
3899
|
});
|
|
3896
3900
|
}
|
|
3897
|
-
function markRecoilValueModified(
|
|
3898
|
-
queueOrPerformStateUpdate(
|
|
3901
|
+
function markRecoilValueModified(store2, recoilValue) {
|
|
3902
|
+
queueOrPerformStateUpdate(store2, {
|
|
3899
3903
|
type: "markModified",
|
|
3900
3904
|
recoilValue
|
|
3901
3905
|
});
|
|
3902
3906
|
}
|
|
3903
|
-
function setUnvalidatedRecoilValue(
|
|
3904
|
-
queueOrPerformStateUpdate(
|
|
3907
|
+
function setUnvalidatedRecoilValue(store2, recoilValue, unvalidatedValue) {
|
|
3908
|
+
queueOrPerformStateUpdate(store2, {
|
|
3905
3909
|
type: "setUnvalidated",
|
|
3906
3910
|
recoilValue,
|
|
3907
3911
|
unvalidatedValue
|
|
3908
3912
|
});
|
|
3909
3913
|
}
|
|
3910
|
-
function subscribeToRecoilValue(
|
|
3914
|
+
function subscribeToRecoilValue(store2, {
|
|
3911
3915
|
key
|
|
3912
3916
|
}, callback, componentDebugName = null) {
|
|
3913
3917
|
const subID = getNextComponentID$1();
|
|
3914
|
-
const storeState =
|
|
3918
|
+
const storeState = store2.getState();
|
|
3915
3919
|
if (!storeState.nodeToComponentSubscriptions.has(key)) {
|
|
3916
3920
|
storeState.nodeToComponentSubscriptions.set(key, /* @__PURE__ */ new Map());
|
|
3917
3921
|
}
|
|
3918
3922
|
Recoil_nullthrows$1(storeState.nodeToComponentSubscriptions.get(key)).set(subID, [componentDebugName !== null && componentDebugName !== void 0 ? componentDebugName : "<not captured>", callback]);
|
|
3919
3923
|
const mode = reactMode$1();
|
|
3920
3924
|
if (mode.early && (mode.mode === "LEGACY" || mode.mode === "MUTABLE_SOURCE")) {
|
|
3921
|
-
const nextTree =
|
|
3925
|
+
const nextTree = store2.getState().nextTree;
|
|
3922
3926
|
if (nextTree && nextTree.dirtyAtoms.has(key)) {
|
|
3923
3927
|
callback(nextTree);
|
|
3924
3928
|
}
|
|
3925
3929
|
}
|
|
3926
3930
|
return {
|
|
3927
3931
|
release: () => {
|
|
3928
|
-
const releaseStoreState =
|
|
3932
|
+
const releaseStoreState = store2.getState();
|
|
3929
3933
|
const subs = releaseStoreState.nodeToComponentSubscriptions.get(key);
|
|
3930
3934
|
if (subs === void 0 || !subs.has(subID)) {
|
|
3931
3935
|
return;
|
|
@@ -3937,13 +3941,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3937
3941
|
}
|
|
3938
3942
|
};
|
|
3939
3943
|
}
|
|
3940
|
-
function refreshRecoilValue(
|
|
3944
|
+
function refreshRecoilValue(store2, recoilValue) {
|
|
3941
3945
|
var _node$clearCache;
|
|
3942
3946
|
const {
|
|
3943
3947
|
currentTree
|
|
3944
|
-
} =
|
|
3948
|
+
} = store2.getState();
|
|
3945
3949
|
const node = getNode$2(recoilValue.key);
|
|
3946
|
-
(_node$clearCache = node.clearCache) === null || _node$clearCache === void 0 ? void 0 : _node$clearCache.call(node,
|
|
3950
|
+
(_node$clearCache = node.clearCache) === null || _node$clearCache === void 0 ? void 0 : _node$clearCache.call(node, store2, currentTree);
|
|
3947
3951
|
}
|
|
3948
3952
|
var Recoil_RecoilValueInterface = {
|
|
3949
3953
|
RecoilValueReadOnly: RecoilValueReadOnly$1,
|
|
@@ -3988,8 +3992,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
3988
3992
|
} = Recoil_RetentionZone;
|
|
3989
3993
|
const SUSPENSE_TIMEOUT_MS = 12e4;
|
|
3990
3994
|
const emptySet$1 = /* @__PURE__ */ new Set();
|
|
3991
|
-
function releaseRetainablesNowOnCurrentTree(
|
|
3992
|
-
const storeState =
|
|
3995
|
+
function releaseRetainablesNowOnCurrentTree(store2, retainables) {
|
|
3996
|
+
const storeState = store2.getState();
|
|
3993
3997
|
const treeState = storeState.currentTree;
|
|
3994
3998
|
if (storeState.nextTree) {
|
|
3995
3999
|
return;
|
|
@@ -4004,15 +4008,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4004
4008
|
nodes2.add(r2);
|
|
4005
4009
|
}
|
|
4006
4010
|
}
|
|
4007
|
-
const releasableNodes = findReleasableNodes(
|
|
4011
|
+
const releasableNodes = findReleasableNodes(store2, nodes2);
|
|
4008
4012
|
for (const node of releasableNodes) {
|
|
4009
|
-
releaseNode(
|
|
4013
|
+
releaseNode(store2, treeState, node);
|
|
4010
4014
|
}
|
|
4011
4015
|
}
|
|
4012
|
-
function findReleasableNodes(
|
|
4013
|
-
const storeState =
|
|
4016
|
+
function findReleasableNodes(store2, searchFromNodes) {
|
|
4017
|
+
const storeState = store2.getState();
|
|
4014
4018
|
const treeState = storeState.currentTree;
|
|
4015
|
-
const graph2 =
|
|
4019
|
+
const graph2 = store2.getGraph(treeState.version);
|
|
4016
4020
|
const releasableNodes = /* @__PURE__ */ new Set();
|
|
4017
4021
|
const nonReleasableNodes = /* @__PURE__ */ new Set();
|
|
4018
4022
|
findReleasableNodesInner(searchFromNodes);
|
|
@@ -4020,7 +4024,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4020
4024
|
function findReleasableNodesInner(searchFromNodes2) {
|
|
4021
4025
|
const releasableNodesFoundThisIteration = /* @__PURE__ */ new Set();
|
|
4022
4026
|
const downstreams = getDownstreamNodesInTopologicalOrder(
|
|
4023
|
-
|
|
4027
|
+
store2,
|
|
4024
4028
|
treeState,
|
|
4025
4029
|
searchFromNodes2,
|
|
4026
4030
|
releasableNodes,
|
|
@@ -4062,8 +4066,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4062
4066
|
}
|
|
4063
4067
|
}
|
|
4064
4068
|
}
|
|
4065
|
-
function getDownstreamNodesInTopologicalOrder(
|
|
4066
|
-
const graph2 =
|
|
4069
|
+
function getDownstreamNodesInTopologicalOrder(store2, treeState, nodes2, doNotDescendInto1, doNotDescendInto2) {
|
|
4070
|
+
const graph2 = store2.getGraph(treeState.version);
|
|
4067
4071
|
const answer = [];
|
|
4068
4072
|
const visited = /* @__PURE__ */ new Set();
|
|
4069
4073
|
while (nodes2.size > 0) {
|
|
@@ -4089,12 +4093,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4089
4093
|
answer.push(node);
|
|
4090
4094
|
}
|
|
4091
4095
|
}
|
|
4092
|
-
function releaseNode(
|
|
4096
|
+
function releaseNode(store2, treeState, node) {
|
|
4093
4097
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4094
4098
|
return;
|
|
4095
4099
|
}
|
|
4096
|
-
cleanUpNode$1(
|
|
4097
|
-
const storeState =
|
|
4100
|
+
cleanUpNode$1(store2, node);
|
|
4101
|
+
const storeState = store2.getState();
|
|
4098
4102
|
storeState.knownAtoms.delete(node);
|
|
4099
4103
|
storeState.knownSelectors.delete(node);
|
|
4100
4104
|
storeState.nodeTransactionSubscriptions.delete(node);
|
|
@@ -4135,41 +4139,41 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4135
4139
|
return retainedBy;
|
|
4136
4140
|
}
|
|
4137
4141
|
}
|
|
4138
|
-
function scheduleOrPerformPossibleReleaseOfRetainable(
|
|
4139
|
-
const state =
|
|
4142
|
+
function scheduleOrPerformPossibleReleaseOfRetainable(store2, retainable) {
|
|
4143
|
+
const state = store2.getState();
|
|
4140
4144
|
if (state.nextTree) {
|
|
4141
4145
|
state.retention.retainablesToCheckForRelease.add(retainable);
|
|
4142
4146
|
} else {
|
|
4143
|
-
releaseRetainablesNowOnCurrentTree(
|
|
4147
|
+
releaseRetainablesNowOnCurrentTree(store2, /* @__PURE__ */ new Set([retainable]));
|
|
4144
4148
|
}
|
|
4145
4149
|
}
|
|
4146
|
-
function updateRetainCount(
|
|
4150
|
+
function updateRetainCount(store2, retainable, delta) {
|
|
4147
4151
|
var _map$get;
|
|
4148
4152
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4149
4153
|
return;
|
|
4150
4154
|
}
|
|
4151
|
-
const map2 =
|
|
4155
|
+
const map2 = store2.getState().retention.referenceCounts;
|
|
4152
4156
|
const newCount = ((_map$get = map2.get(retainable)) !== null && _map$get !== void 0 ? _map$get : 0) + delta;
|
|
4153
4157
|
if (newCount === 0) {
|
|
4154
|
-
updateRetainCountToZero(
|
|
4158
|
+
updateRetainCountToZero(store2, retainable);
|
|
4155
4159
|
} else {
|
|
4156
4160
|
map2.set(retainable, newCount);
|
|
4157
4161
|
}
|
|
4158
4162
|
}
|
|
4159
|
-
function updateRetainCountToZero(
|
|
4163
|
+
function updateRetainCountToZero(store2, retainable) {
|
|
4160
4164
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4161
4165
|
return;
|
|
4162
4166
|
}
|
|
4163
|
-
const map2 =
|
|
4167
|
+
const map2 = store2.getState().retention.referenceCounts;
|
|
4164
4168
|
map2.delete(retainable);
|
|
4165
|
-
scheduleOrPerformPossibleReleaseOfRetainable(
|
|
4169
|
+
scheduleOrPerformPossibleReleaseOfRetainable(store2, retainable);
|
|
4166
4170
|
}
|
|
4167
|
-
function releaseScheduledRetainablesNow(
|
|
4171
|
+
function releaseScheduledRetainablesNow(store2) {
|
|
4168
4172
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4169
4173
|
return;
|
|
4170
4174
|
}
|
|
4171
|
-
const state =
|
|
4172
|
-
releaseRetainablesNowOnCurrentTree(
|
|
4175
|
+
const state = store2.getState();
|
|
4176
|
+
releaseRetainablesNowOnCurrentTree(store2, state.retention.retainablesToCheckForRelease);
|
|
4173
4177
|
state.retention.retainablesToCheckForRelease.clear();
|
|
4174
4178
|
}
|
|
4175
4179
|
function retainedByOptionWithDefault(r2) {
|
|
@@ -4450,8 +4454,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4450
4454
|
return this._store.storeID;
|
|
4451
4455
|
}
|
|
4452
4456
|
}
|
|
4453
|
-
function cloneStoreState(
|
|
4454
|
-
const storeState =
|
|
4457
|
+
function cloneStoreState(store2, treeState, bumpVersion = false) {
|
|
4458
|
+
const storeState = store2.getState();
|
|
4455
4459
|
const version = bumpVersion ? getNextTreeStateVersion$2() : treeState.version;
|
|
4456
4460
|
return {
|
|
4457
4461
|
currentTree: {
|
|
@@ -4474,7 +4478,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4474
4478
|
nodeToComponentSubscriptions: /* @__PURE__ */ new Map(),
|
|
4475
4479
|
queuedComponentCallbacks_DEPRECATED: [],
|
|
4476
4480
|
suspendedComponentResolvers: /* @__PURE__ */ new Set(),
|
|
4477
|
-
graphsByVersion: (/* @__PURE__ */ new Map()).set(version,
|
|
4481
|
+
graphsByVersion: (/* @__PURE__ */ new Map()).set(version, store2.getGraph(treeState.version)),
|
|
4478
4482
|
retention: {
|
|
4479
4483
|
referenceCounts: /* @__PURE__ */ new Map(),
|
|
4480
4484
|
nodesRetainedByZone: /* @__PURE__ */ new Map(),
|
|
@@ -4489,23 +4493,23 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4489
4493
|
return initializeState != null ? snapshot.map(initializeState) : snapshot;
|
|
4490
4494
|
}
|
|
4491
4495
|
const [memoizedCloneSnapshot, invalidateMemoizedSnapshot$2] = memoizeOneWithArgsHashAndInvalidation$1(
|
|
4492
|
-
(
|
|
4496
|
+
(store2, version) => {
|
|
4493
4497
|
var _storeState$nextTree;
|
|
4494
|
-
const storeState =
|
|
4498
|
+
const storeState = store2.getState();
|
|
4495
4499
|
const treeState = version === "latest" ? (_storeState$nextTree = storeState.nextTree) !== null && _storeState$nextTree !== void 0 ? _storeState$nextTree : storeState.currentTree : Recoil_nullthrows$1(storeState.previousTree);
|
|
4496
|
-
return new Snapshot(cloneStoreState(
|
|
4500
|
+
return new Snapshot(cloneStoreState(store2, treeState), store2.storeID);
|
|
4497
4501
|
},
|
|
4498
|
-
(
|
|
4502
|
+
(store2, version) => {
|
|
4499
4503
|
var _store$getState$nextT, _store$getState$previ;
|
|
4500
|
-
return String(version) + String(
|
|
4504
|
+
return String(version) + String(store2.storeID) + String((_store$getState$nextT = store2.getState().nextTree) === null || _store$getState$nextT === void 0 ? void 0 : _store$getState$nextT.version) + String(store2.getState().currentTree.version) + String((_store$getState$previ = store2.getState().previousTree) === null || _store$getState$previ === void 0 ? void 0 : _store$getState$previ.version);
|
|
4501
4505
|
}
|
|
4502
4506
|
);
|
|
4503
4507
|
setInvalidateMemoizedSnapshot$1(invalidateMemoizedSnapshot$2);
|
|
4504
|
-
function cloneSnapshot(
|
|
4505
|
-
const snapshot = memoizedCloneSnapshot(
|
|
4508
|
+
function cloneSnapshot(store2, version = "latest") {
|
|
4509
|
+
const snapshot = memoizedCloneSnapshot(store2, version);
|
|
4506
4510
|
if (!snapshot.isRetained()) {
|
|
4507
4511
|
invalidateMemoizedSnapshot$2();
|
|
4508
|
-
return memoizedCloneSnapshot(
|
|
4512
|
+
return memoizedCloneSnapshot(store2, version);
|
|
4509
4513
|
}
|
|
4510
4514
|
return snapshot;
|
|
4511
4515
|
}
|
|
@@ -4515,27 +4519,27 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4515
4519
|
_defineProperty$a(this, "_batch", void 0);
|
|
4516
4520
|
_defineProperty$a(this, "set", (recoilState, newValueOrUpdater) => {
|
|
4517
4521
|
this.checkRefCount_INTERNAL();
|
|
4518
|
-
const
|
|
4522
|
+
const store2 = this.getStore_INTERNAL();
|
|
4519
4523
|
this._batch(() => {
|
|
4520
|
-
updateRetainCount$1(
|
|
4524
|
+
updateRetainCount$1(store2, recoilState.key, 1);
|
|
4521
4525
|
setRecoilValue$1(this.getStore_INTERNAL(), recoilState, newValueOrUpdater);
|
|
4522
4526
|
});
|
|
4523
4527
|
});
|
|
4524
4528
|
_defineProperty$a(this, "reset", (recoilState) => {
|
|
4525
4529
|
this.checkRefCount_INTERNAL();
|
|
4526
|
-
const
|
|
4530
|
+
const store2 = this.getStore_INTERNAL();
|
|
4527
4531
|
this._batch(() => {
|
|
4528
|
-
updateRetainCount$1(
|
|
4532
|
+
updateRetainCount$1(store2, recoilState.key, 1);
|
|
4529
4533
|
setRecoilValue$1(this.getStore_INTERNAL(), recoilState, DEFAULT_VALUE$1$1);
|
|
4530
4534
|
});
|
|
4531
4535
|
});
|
|
4532
4536
|
_defineProperty$a(this, "setUnvalidatedAtomValues_DEPRECATED", (values) => {
|
|
4533
4537
|
this.checkRefCount_INTERNAL();
|
|
4534
|
-
const
|
|
4538
|
+
const store2 = this.getStore_INTERNAL();
|
|
4535
4539
|
batchUpdates$1(() => {
|
|
4536
4540
|
for (const [k2, v2] of values.entries()) {
|
|
4537
|
-
updateRetainCount$1(
|
|
4538
|
-
setUnvalidatedRecoilValue$1(
|
|
4541
|
+
updateRetainCount$1(store2, k2, 1);
|
|
4542
|
+
setUnvalidatedRecoilValue$1(store2, new AbstractRecoilValue$2(k2), v2);
|
|
4539
4543
|
}
|
|
4540
4544
|
});
|
|
4541
4545
|
});
|
|
@@ -4633,15 +4637,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4633
4637
|
addTransactionMetadata: notInAContext
|
|
4634
4638
|
});
|
|
4635
4639
|
let stateReplacerIsBeingExecuted = false;
|
|
4636
|
-
function startNextTreeIfNeeded(
|
|
4640
|
+
function startNextTreeIfNeeded(store2) {
|
|
4637
4641
|
if (stateReplacerIsBeingExecuted) {
|
|
4638
4642
|
throw Recoil_err$2("An atom update was triggered within the execution of a state updater function. State updater functions provided to Recoil must be pure functions.");
|
|
4639
4643
|
}
|
|
4640
|
-
const storeState =
|
|
4644
|
+
const storeState = store2.getState();
|
|
4641
4645
|
if (storeState.nextTree === null) {
|
|
4642
4646
|
if (Recoil_gkx("recoil_memory_managament_2020") && Recoil_gkx("recoil_release_on_cascading_update_killswitch_2021")) {
|
|
4643
4647
|
if (storeState.commitDepth > 0) {
|
|
4644
|
-
releaseScheduledRetainablesNow$1(
|
|
4648
|
+
releaseScheduledRetainablesNow$1(store2);
|
|
4645
4649
|
}
|
|
4646
4650
|
}
|
|
4647
4651
|
const version = storeState.currentTree.version;
|
|
@@ -4665,8 +4669,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4665
4669
|
const mutableSource = useContext(MutableSourceContext);
|
|
4666
4670
|
return mutableSource;
|
|
4667
4671
|
}
|
|
4668
|
-
function notifyComponents(
|
|
4669
|
-
const dependentNodes = getDownstreamNodes$2(
|
|
4672
|
+
function notifyComponents(store2, storeState, treeState) {
|
|
4673
|
+
const dependentNodes = getDownstreamNodes$2(store2, treeState, treeState.dirtyAtoms);
|
|
4670
4674
|
for (const key of dependentNodes) {
|
|
4671
4675
|
const comps = storeState.nodeToComponentSubscriptions.get(key);
|
|
4672
4676
|
if (comps) {
|
|
@@ -4676,23 +4680,23 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4676
4680
|
}
|
|
4677
4681
|
}
|
|
4678
4682
|
}
|
|
4679
|
-
function sendEndOfBatchNotifications(
|
|
4680
|
-
const storeState =
|
|
4683
|
+
function sendEndOfBatchNotifications(store2) {
|
|
4684
|
+
const storeState = store2.getState();
|
|
4681
4685
|
const treeState = storeState.currentTree;
|
|
4682
4686
|
const dirtyAtoms = treeState.dirtyAtoms;
|
|
4683
4687
|
if (dirtyAtoms.size) {
|
|
4684
4688
|
for (const [key, subscriptions] of storeState.nodeTransactionSubscriptions) {
|
|
4685
4689
|
if (dirtyAtoms.has(key)) {
|
|
4686
4690
|
for (const [_, subscription] of subscriptions) {
|
|
4687
|
-
subscription(
|
|
4691
|
+
subscription(store2);
|
|
4688
4692
|
}
|
|
4689
4693
|
}
|
|
4690
4694
|
}
|
|
4691
4695
|
for (const [_, subscription] of storeState.transactionSubscriptions) {
|
|
4692
|
-
subscription(
|
|
4696
|
+
subscription(store2);
|
|
4693
4697
|
}
|
|
4694
4698
|
if (!reactMode$2().early || storeState.suspendedComponentResolvers.size > 0) {
|
|
4695
|
-
notifyComponents(
|
|
4699
|
+
notifyComponents(store2, storeState, treeState);
|
|
4696
4700
|
storeState.suspendedComponentResolvers.forEach((cb) => cb());
|
|
4697
4701
|
storeState.suspendedComponentResolvers.clear();
|
|
4698
4702
|
}
|
|
@@ -4700,8 +4704,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4700
4704
|
storeState.queuedComponentCallbacks_DEPRECATED.forEach((cb) => cb(treeState));
|
|
4701
4705
|
storeState.queuedComponentCallbacks_DEPRECATED.splice(0, storeState.queuedComponentCallbacks_DEPRECATED.length);
|
|
4702
4706
|
}
|
|
4703
|
-
function endBatch(
|
|
4704
|
-
const storeState =
|
|
4707
|
+
function endBatch(store2) {
|
|
4708
|
+
const storeState = store2.getState();
|
|
4705
4709
|
storeState.commitDepth++;
|
|
4706
4710
|
try {
|
|
4707
4711
|
const {
|
|
@@ -4713,7 +4717,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4713
4717
|
storeState.previousTree = storeState.currentTree;
|
|
4714
4718
|
storeState.currentTree = nextTree;
|
|
4715
4719
|
storeState.nextTree = null;
|
|
4716
|
-
sendEndOfBatchNotifications(
|
|
4720
|
+
sendEndOfBatchNotifications(store2);
|
|
4717
4721
|
if (storeState.previousTree != null) {
|
|
4718
4722
|
storeState.graphsByVersion.delete(storeState.previousTree.version);
|
|
4719
4723
|
} else {
|
|
@@ -4722,7 +4726,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4722
4726
|
storeState.previousTree = null;
|
|
4723
4727
|
if (Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4724
4728
|
if (nextTree == null) {
|
|
4725
|
-
releaseScheduledRetainablesNow$1(
|
|
4729
|
+
releaseScheduledRetainablesNow$1(store2);
|
|
4726
4730
|
}
|
|
4727
4731
|
}
|
|
4728
4732
|
} finally {
|
|
@@ -4749,12 +4753,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4749
4753
|
});
|
|
4750
4754
|
return null;
|
|
4751
4755
|
}
|
|
4752
|
-
function initialStoreState_DEPRECATED(
|
|
4756
|
+
function initialStoreState_DEPRECATED(store2, initializeState) {
|
|
4753
4757
|
const initial2 = makeEmptyStoreState$2();
|
|
4754
4758
|
initializeState({
|
|
4755
4759
|
set: (atom2, value) => {
|
|
4756
4760
|
const state = initial2.currentTree;
|
|
4757
|
-
const writes = setNodeValue$2(
|
|
4761
|
+
const writes = setNodeValue$2(store2, state, atom2.key, value);
|
|
4758
4762
|
const writtenNodes = new Set(writes.keys());
|
|
4759
4763
|
const nonvalidatedAtoms = state.nonvalidatedAtoms.clone();
|
|
4760
4764
|
for (const n2 of writtenNodes) {
|
|
@@ -4877,13 +4881,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4877
4881
|
storeStateRef = Recoil_useRefInitOnce(() => initializeState_DEPRECATED != null ? initialStoreState_DEPRECATED(storeRef.current, initializeState_DEPRECATED) : initializeState != null ? initialStoreState(initializeState) : makeEmptyStoreState$2());
|
|
4878
4882
|
const mutableSource = useMemo$2(() => createMutableSource$1 === null || createMutableSource$1 === void 0 ? void 0 : createMutableSource$1(storeStateRef, () => storeStateRef.current.currentTree.version), [storeStateRef]);
|
|
4879
4883
|
useEffect$4(() => {
|
|
4880
|
-
const
|
|
4881
|
-
for (const atomKey of new Set(
|
|
4882
|
-
initializeNode$2(
|
|
4884
|
+
const store2 = storeRef.current;
|
|
4885
|
+
for (const atomKey of new Set(store2.getState().knownAtoms)) {
|
|
4886
|
+
initializeNode$2(store2, atomKey, "get");
|
|
4883
4887
|
}
|
|
4884
4888
|
return () => {
|
|
4885
|
-
for (const atomKey of
|
|
4886
|
-
cleanUpNode$2(
|
|
4889
|
+
for (const atomKey of store2.getState().knownAtoms) {
|
|
4890
|
+
cleanUpNode$2(store2, atomKey);
|
|
4887
4891
|
}
|
|
4888
4892
|
};
|
|
4889
4893
|
}, [storeRef]);
|
|
@@ -4977,31 +4981,31 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
4977
4981
|
if (!Recoil_gkx("recoil_memory_managament_2020")) {
|
|
4978
4982
|
return;
|
|
4979
4983
|
}
|
|
4980
|
-
const
|
|
4984
|
+
const store2 = storeRef.current;
|
|
4981
4985
|
if (timeoutID.current && !isSSR$2) {
|
|
4982
4986
|
window.clearTimeout(timeoutID.current);
|
|
4983
4987
|
timeoutID.current = null;
|
|
4984
4988
|
} else {
|
|
4985
4989
|
for (const r2 of retainables) {
|
|
4986
|
-
updateRetainCount$2(
|
|
4990
|
+
updateRetainCount$2(store2, r2, 1);
|
|
4987
4991
|
}
|
|
4988
4992
|
}
|
|
4989
4993
|
return () => {
|
|
4990
4994
|
for (const r2 of retainables) {
|
|
4991
|
-
updateRetainCount$2(
|
|
4995
|
+
updateRetainCount$2(store2, r2, -1);
|
|
4992
4996
|
}
|
|
4993
4997
|
};
|
|
4994
4998
|
}, [storeRef, ...retainables]);
|
|
4995
4999
|
const timeoutID = useRef$3$1();
|
|
4996
5000
|
const previousRetainables = Recoil_usePrevious$1(retainables);
|
|
4997
5001
|
if (!isSSR$2 && (previousRetainables === void 0 || !Recoil_shallowArrayEqual(previousRetainables, retainables))) {
|
|
4998
|
-
const
|
|
5002
|
+
const store2 = storeRef.current;
|
|
4999
5003
|
for (const r2 of retainables) {
|
|
5000
|
-
updateRetainCount$2(
|
|
5004
|
+
updateRetainCount$2(store2, r2, 1);
|
|
5001
5005
|
}
|
|
5002
5006
|
if (previousRetainables) {
|
|
5003
5007
|
for (const r2 of previousRetainables) {
|
|
5004
|
-
updateRetainCount$2(
|
|
5008
|
+
updateRetainCount$2(store2, r2, -1);
|
|
5005
5009
|
}
|
|
5006
5010
|
}
|
|
5007
5011
|
if (timeoutID.current) {
|
|
@@ -5010,7 +5014,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5010
5014
|
timeoutID.current = window.setTimeout(() => {
|
|
5011
5015
|
timeoutID.current = null;
|
|
5012
5016
|
for (const r2 of retainables) {
|
|
5013
|
-
updateRetainCount$2(
|
|
5017
|
+
updateRetainCount$2(store2, r2, -1);
|
|
5014
5018
|
}
|
|
5015
5019
|
}, SUSPENSE_TIMEOUT_MS$1);
|
|
5016
5020
|
}
|
|
@@ -5091,26 +5095,26 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5091
5095
|
subscriptions.current.delete(key);
|
|
5092
5096
|
}
|
|
5093
5097
|
}, [subscriptions]);
|
|
5094
|
-
const updateState = useCallback$1$1((
|
|
5098
|
+
const updateState = useCallback$1$1((_state2, key) => {
|
|
5095
5099
|
if (subscriptions.current.has(key)) {
|
|
5096
5100
|
forceUpdate([]);
|
|
5097
5101
|
}
|
|
5098
5102
|
}, []);
|
|
5099
5103
|
useEffect$3$1(() => {
|
|
5100
|
-
const
|
|
5104
|
+
const store2 = storeRef.current;
|
|
5101
5105
|
Recoil_differenceSets(recoilValuesUsed.current, previousSubscriptions.current).forEach((key) => {
|
|
5102
5106
|
if (subscriptions.current.has(key)) {
|
|
5103
5107
|
return;
|
|
5104
5108
|
}
|
|
5105
|
-
const sub = subscribeToRecoilValue$1(
|
|
5109
|
+
const sub = subscribeToRecoilValue$1(store2, new AbstractRecoilValue$3(key), (state2) => updateState(state2, key), componentName);
|
|
5106
5110
|
subscriptions.current.set(key, sub);
|
|
5107
|
-
const state =
|
|
5111
|
+
const state = store2.getState();
|
|
5108
5112
|
if (state.nextTree) {
|
|
5109
|
-
|
|
5110
|
-
updateState(
|
|
5113
|
+
store2.getState().queuedComponentCallbacks_DEPRECATED.push(() => {
|
|
5114
|
+
updateState(store2.getState(), key);
|
|
5111
5115
|
});
|
|
5112
5116
|
} else {
|
|
5113
|
-
updateState(
|
|
5117
|
+
updateState(store2.getState(), key);
|
|
5114
5118
|
}
|
|
5115
5119
|
});
|
|
5116
5120
|
Recoil_differenceSets(previousSubscriptions.current, recoilValuesUsed.current).forEach((key) => {
|
|
@@ -5171,10 +5175,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5171
5175
|
const componentName = Recoil_useComponentName();
|
|
5172
5176
|
const getSnapshot = useCallback$1$1(() => {
|
|
5173
5177
|
var _storeState$nextTree2;
|
|
5174
|
-
const
|
|
5175
|
-
const storeState =
|
|
5178
|
+
const store2 = storeRef.current;
|
|
5179
|
+
const storeState = store2.getState();
|
|
5176
5180
|
const treeState = reactMode$3().early ? (_storeState$nextTree2 = storeState.nextTree) !== null && _storeState$nextTree2 !== void 0 ? _storeState$nextTree2 : storeState.currentTree : storeState.currentTree;
|
|
5177
|
-
const loadable = getRecoilValueAsLoadable$2(
|
|
5181
|
+
const loadable = getRecoilValueAsLoadable$2(store2, recoilValue, treeState);
|
|
5178
5182
|
return {
|
|
5179
5183
|
loadable,
|
|
5180
5184
|
key: recoilValue.key
|
|
@@ -5194,8 +5198,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5194
5198
|
}, []);
|
|
5195
5199
|
const getMemoizedSnapshot = useMemo$1$1(() => memoizePreviousSnapshot(getSnapshot), [getSnapshot, memoizePreviousSnapshot]);
|
|
5196
5200
|
const subscribe = useCallback$1$1((notify) => {
|
|
5197
|
-
const
|
|
5198
|
-
const subscription = subscribeToRecoilValue$1(
|
|
5201
|
+
const store2 = storeRef.current;
|
|
5202
|
+
const subscription = subscribeToRecoilValue$1(store2, recoilValue, notify, componentName);
|
|
5199
5203
|
return subscription.release;
|
|
5200
5204
|
}, [storeRef, recoilValue, componentName]);
|
|
5201
5205
|
return useSyncExternalStore$1(
|
|
@@ -5208,18 +5212,18 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5208
5212
|
const storeRef = useStoreRef$2();
|
|
5209
5213
|
const getLoadable = useCallback$1$1(() => {
|
|
5210
5214
|
var _storeState$nextTree3;
|
|
5211
|
-
const
|
|
5212
|
-
const storeState =
|
|
5215
|
+
const store2 = storeRef.current;
|
|
5216
|
+
const storeState = store2.getState();
|
|
5213
5217
|
const treeState = reactMode$3().early ? (_storeState$nextTree3 = storeState.nextTree) !== null && _storeState$nextTree3 !== void 0 ? _storeState$nextTree3 : storeState.currentTree : storeState.currentTree;
|
|
5214
|
-
return getRecoilValueAsLoadable$2(
|
|
5218
|
+
return getRecoilValueAsLoadable$2(store2, recoilValue, treeState);
|
|
5215
5219
|
}, [storeRef, recoilValue]);
|
|
5216
5220
|
const getLoadableWithTesting = useCallback$1$1(() => {
|
|
5217
5221
|
return getLoadable();
|
|
5218
5222
|
}, [getLoadable]);
|
|
5219
5223
|
const componentName = Recoil_useComponentName();
|
|
5220
5224
|
const subscribe = useCallback$1$1((_storeState, notify) => {
|
|
5221
|
-
const
|
|
5222
|
-
const subscription = subscribeToRecoilValue$1(
|
|
5225
|
+
const store2 = storeRef.current;
|
|
5226
|
+
const subscription = subscribeToRecoilValue$1(store2, recoilValue, () => {
|
|
5223
5227
|
if (!Recoil_gkx("recoil_suppress_rerender_in_callback")) {
|
|
5224
5228
|
return notify();
|
|
5225
5229
|
}
|
|
@@ -5247,10 +5251,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5247
5251
|
const componentName = Recoil_useComponentName();
|
|
5248
5252
|
const getLoadable = useCallback$1$1(() => {
|
|
5249
5253
|
var _storeState$nextTree4;
|
|
5250
|
-
const
|
|
5251
|
-
const storeState =
|
|
5254
|
+
const store2 = storeRef.current;
|
|
5255
|
+
const storeState = store2.getState();
|
|
5252
5256
|
const treeState = reactMode$3().early ? (_storeState$nextTree4 = storeState.nextTree) !== null && _storeState$nextTree4 !== void 0 ? _storeState$nextTree4 : storeState.currentTree : storeState.currentTree;
|
|
5253
|
-
return getRecoilValueAsLoadable$2(
|
|
5257
|
+
return getRecoilValueAsLoadable$2(store2, recoilValue, treeState);
|
|
5254
5258
|
}, [storeRef, recoilValue]);
|
|
5255
5259
|
const getState2 = useCallback$1$1(() => ({
|
|
5256
5260
|
loadable: getLoadable(),
|
|
@@ -5261,7 +5265,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5261
5265
|
return prevState.loadable.is(nextState.loadable) && prevState.key === nextState.key ? prevState : nextState;
|
|
5262
5266
|
}, [getState2]);
|
|
5263
5267
|
useEffect$3$1(() => {
|
|
5264
|
-
const subscription = subscribeToRecoilValue$1(storeRef.current, recoilValue, (
|
|
5268
|
+
const subscription = subscribeToRecoilValue$1(storeRef.current, recoilValue, (_state2) => {
|
|
5265
5269
|
setState(updateState);
|
|
5266
5270
|
}, componentName);
|
|
5267
5271
|
setState(updateState);
|
|
@@ -5276,10 +5280,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5276
5280
|
const componentName = Recoil_useComponentName();
|
|
5277
5281
|
const getLoadable = useCallback$1$1(() => {
|
|
5278
5282
|
var _storeState$nextTree5;
|
|
5279
|
-
const
|
|
5280
|
-
const storeState =
|
|
5283
|
+
const store2 = storeRef.current;
|
|
5284
|
+
const storeState = store2.getState();
|
|
5281
5285
|
const treeState = reactMode$3().early ? (_storeState$nextTree5 = storeState.nextTree) !== null && _storeState$nextTree5 !== void 0 ? _storeState$nextTree5 : storeState.currentTree : storeState.currentTree;
|
|
5282
|
-
return getRecoilValueAsLoadable$2(
|
|
5286
|
+
return getRecoilValueAsLoadable$2(store2, recoilValue, treeState);
|
|
5283
5287
|
}, [storeRef, recoilValue]);
|
|
5284
5288
|
const loadable = getLoadable();
|
|
5285
5289
|
const prevLoadableRef = useRef$4(loadable);
|
|
@@ -5287,9 +5291,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5287
5291
|
prevLoadableRef.current = loadable;
|
|
5288
5292
|
});
|
|
5289
5293
|
useEffect$3$1(() => {
|
|
5290
|
-
const
|
|
5291
|
-
const storeState =
|
|
5292
|
-
const subscription = subscribeToRecoilValue$1(
|
|
5294
|
+
const store2 = storeRef.current;
|
|
5295
|
+
const storeState = store2.getState();
|
|
5296
|
+
const subscription = subscribeToRecoilValue$1(store2, recoilValue, (_state2) => {
|
|
5293
5297
|
var _prevLoadableRef$curr;
|
|
5294
5298
|
if (!Recoil_gkx("recoil_suppress_rerender_in_callback")) {
|
|
5295
5299
|
return forceUpdate([]);
|
|
@@ -5301,7 +5305,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5301
5305
|
prevLoadableRef.current = newLoadable;
|
|
5302
5306
|
}, componentName);
|
|
5303
5307
|
if (storeState.nextTree) {
|
|
5304
|
-
|
|
5308
|
+
store2.getState().queuedComponentCallbacks_DEPRECATED.push(() => {
|
|
5305
5309
|
prevLoadableRef.current = null;
|
|
5306
5310
|
forceUpdate([]);
|
|
5307
5311
|
});
|
|
@@ -5470,11 +5474,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5470
5474
|
return Recoil_mergeMaps(state.nonvalidatedAtoms.toMap(), persistedAtomContentsValues);
|
|
5471
5475
|
}
|
|
5472
5476
|
function useTransactionObservation_DEPRECATED(callback) {
|
|
5473
|
-
useTransactionSubscription(useCallback$2$1((
|
|
5474
|
-
let previousTree =
|
|
5475
|
-
const currentTree =
|
|
5477
|
+
useTransactionSubscription(useCallback$2$1((store2) => {
|
|
5478
|
+
let previousTree = store2.getState().previousTree;
|
|
5479
|
+
const currentTree = store2.getState().currentTree;
|
|
5476
5480
|
if (!previousTree) {
|
|
5477
|
-
previousTree =
|
|
5481
|
+
previousTree = store2.getState().currentTree;
|
|
5478
5482
|
}
|
|
5479
5483
|
const atomValues = externallyVisibleAtomValuesInState(currentTree);
|
|
5480
5484
|
const previousAtomValues = externallyVisibleAtomValuesInState(previousTree);
|
|
@@ -5500,9 +5504,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5500
5504
|
}, [callback]));
|
|
5501
5505
|
}
|
|
5502
5506
|
function useRecoilTransactionObserver(callback) {
|
|
5503
|
-
useTransactionSubscription(useCallback$2$1((
|
|
5504
|
-
const snapshot = cloneSnapshot$1(
|
|
5505
|
-
const previousSnapshot = cloneSnapshot$1(
|
|
5507
|
+
useTransactionSubscription(useCallback$2$1((store2) => {
|
|
5508
|
+
const snapshot = cloneSnapshot$1(store2, "latest");
|
|
5509
|
+
const previousSnapshot = cloneSnapshot$1(store2, "previous");
|
|
5506
5510
|
callback({
|
|
5507
5511
|
snapshot,
|
|
5508
5512
|
previousSnapshot
|
|
@@ -5515,7 +5519,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5515
5519
|
const previousSnapshot = Recoil_usePrevious$1(snapshot);
|
|
5516
5520
|
const timeoutID = useRef$5();
|
|
5517
5521
|
const releaseRef = useRef$5();
|
|
5518
|
-
useTransactionSubscription(useCallback$2$1((
|
|
5522
|
+
useTransactionSubscription(useCallback$2$1((store2) => setSnapshot(cloneSnapshot$1(store2)), []));
|
|
5519
5523
|
useEffect$4$1(() => {
|
|
5520
5524
|
const release = snapshot.retain();
|
|
5521
5525
|
if (timeoutID.current && !isSSR$4) {
|
|
@@ -5547,9 +5551,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5547
5551
|
}
|
|
5548
5552
|
return snapshot;
|
|
5549
5553
|
}
|
|
5550
|
-
function gotoSnapshot(
|
|
5554
|
+
function gotoSnapshot(store2, snapshot) {
|
|
5551
5555
|
var _storeState$nextTree;
|
|
5552
|
-
const storeState =
|
|
5556
|
+
const storeState = store2.getState();
|
|
5553
5557
|
const prev = (_storeState$nextTree = storeState.nextTree) !== null && _storeState$nextTree !== void 0 ? _storeState$nextTree : storeState.currentTree;
|
|
5554
5558
|
const next = snapshot.getStore_INTERNAL().getState().currentTree;
|
|
5555
5559
|
batchUpdates$3(() => {
|
|
@@ -5563,9 +5567,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5563
5567
|
}
|
|
5564
5568
|
}
|
|
5565
5569
|
keysToUpdate.forEach((key) => {
|
|
5566
|
-
setRecoilValueLoadable$1(
|
|
5570
|
+
setRecoilValueLoadable$1(store2, new AbstractRecoilValue$4(key), next.atomValues.has(key) ? Recoil_nullthrows$1(next.atomValues.get(key)) : DEFAULT_VALUE$3);
|
|
5567
5571
|
});
|
|
5568
|
-
|
|
5572
|
+
store2.replaceState((state) => ({
|
|
5569
5573
|
...state,
|
|
5570
5574
|
stateID: snapshot.getID()
|
|
5571
5575
|
}));
|
|
@@ -5610,17 +5614,17 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5610
5614
|
if (reactMode$4().mode === "MUTABLE_SOURCE") {
|
|
5611
5615
|
console.warn("Warning: There are known issues using useRecoilBridgeAcrossReactRoots() in recoil_mutable_source rendering mode. Please consider upgrading to recoil_sync_external_store mode.");
|
|
5612
5616
|
}
|
|
5613
|
-
const
|
|
5617
|
+
const store2 = useStoreRef$5().current;
|
|
5614
5618
|
return useMemo$2$1(() => {
|
|
5615
5619
|
function RecoilBridge({
|
|
5616
5620
|
children
|
|
5617
5621
|
}) {
|
|
5618
5622
|
return /* @__PURE__ */ React__default.default.createElement(RecoilRoot$1, {
|
|
5619
|
-
store_INTERNAL:
|
|
5623
|
+
store_INTERNAL: store2
|
|
5620
5624
|
}, children);
|
|
5621
5625
|
}
|
|
5622
5626
|
return RecoilBridge;
|
|
5623
|
-
}, [
|
|
5627
|
+
}, [store2]);
|
|
5624
5628
|
}
|
|
5625
5629
|
var Recoil_useRecoilBridgeAcrossReactRoots = useRecoilBridgeAcrossReactRoots;
|
|
5626
5630
|
const {
|
|
@@ -5643,7 +5647,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5643
5647
|
return getNode$5(recoilValue.key).nodeType === "atom";
|
|
5644
5648
|
}
|
|
5645
5649
|
class TransactionInterfaceImpl {
|
|
5646
|
-
constructor(
|
|
5650
|
+
constructor(store2, treeState) {
|
|
5647
5651
|
_defineProperty$a(this, "_store", void 0);
|
|
5648
5652
|
_defineProperty$a(this, "_treeState", void 0);
|
|
5649
5653
|
_defineProperty$a(this, "_changes", void 0);
|
|
@@ -5678,7 +5682,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5678
5682
|
_defineProperty$a(this, "reset", (recoilState) => {
|
|
5679
5683
|
this.set(recoilState, DEFAULT_VALUE$4);
|
|
5680
5684
|
});
|
|
5681
|
-
this._store =
|
|
5685
|
+
this._store = store2;
|
|
5682
5686
|
this._treeState = treeState;
|
|
5683
5687
|
this._changes = /* @__PURE__ */ new Map();
|
|
5684
5688
|
}
|
|
@@ -5694,10 +5698,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5694
5698
|
return newState;
|
|
5695
5699
|
}
|
|
5696
5700
|
}
|
|
5697
|
-
function atomicUpdater(
|
|
5701
|
+
function atomicUpdater(store2) {
|
|
5698
5702
|
return (fn) => {
|
|
5699
|
-
|
|
5700
|
-
const changeset = new TransactionInterfaceImpl(
|
|
5703
|
+
store2.replaceState((treeState) => {
|
|
5704
|
+
const changeset = new TransactionInterfaceImpl(store2, treeState);
|
|
5701
5705
|
fn(changeset);
|
|
5702
5706
|
return changeset.newTreeState_INTERNAL();
|
|
5703
5707
|
});
|
|
@@ -5746,7 +5750,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5746
5750
|
class Sentinel {
|
|
5747
5751
|
}
|
|
5748
5752
|
const SENTINEL = new Sentinel();
|
|
5749
|
-
function recoilCallback(
|
|
5753
|
+
function recoilCallback(store2, fn, args, extraInterface) {
|
|
5750
5754
|
let ret = SENTINEL;
|
|
5751
5755
|
let releaseSnapshot;
|
|
5752
5756
|
batchUpdates$4(() => {
|
|
@@ -5756,14 +5760,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5756
5760
|
}
|
|
5757
5761
|
const callbackInterface = Recoil_lazyProxy$1({
|
|
5758
5762
|
...extraInterface !== null && extraInterface !== void 0 ? extraInterface : {},
|
|
5759
|
-
set: (node, newValue) => setRecoilValue$3(
|
|
5760
|
-
reset: (node) => setRecoilValue$3(
|
|
5761
|
-
refresh: (node) => refreshRecoilValue$1(
|
|
5762
|
-
gotoSnapshot: (snapshot) => gotoSnapshot$1(
|
|
5763
|
-
transact_UNSTABLE: (transaction) => atomicUpdater$1(
|
|
5763
|
+
set: (node, newValue) => setRecoilValue$3(store2, node, newValue),
|
|
5764
|
+
reset: (node) => setRecoilValue$3(store2, node, DEFAULT_VALUE$5),
|
|
5765
|
+
refresh: (node) => refreshRecoilValue$1(store2, node),
|
|
5766
|
+
gotoSnapshot: (snapshot) => gotoSnapshot$1(store2, snapshot),
|
|
5767
|
+
transact_UNSTABLE: (transaction) => atomicUpdater$1(store2)(transaction)
|
|
5764
5768
|
}, {
|
|
5765
5769
|
snapshot: () => {
|
|
5766
|
-
const snapshot = cloneSnapshot$2(
|
|
5770
|
+
const snapshot = cloneSnapshot$2(store2);
|
|
5767
5771
|
releaseSnapshot = snapshot.retain();
|
|
5768
5772
|
return snapshot;
|
|
5769
5773
|
}
|
|
@@ -5811,8 +5815,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
5811
5815
|
function useRecoilRefresher(recoilValue) {
|
|
5812
5816
|
const storeRef = useStoreRef$7();
|
|
5813
5817
|
return useCallback$4$1(() => {
|
|
5814
|
-
const
|
|
5815
|
-
refreshRecoilValue$2(
|
|
5818
|
+
const store2 = storeRef.current;
|
|
5819
|
+
refreshRecoilValue$2(store2, recoilValue);
|
|
5816
5820
|
}, [recoilValue, storeRef]);
|
|
5817
5821
|
}
|
|
5818
5822
|
var Recoil_useRecoilRefresher = useRecoilRefresher;
|
|
@@ -6336,8 +6340,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6336
6340
|
function selectorIsLive() {
|
|
6337
6341
|
return !Recoil_gkx("recoil_memory_managament_2020") || liveStoresCount > 0;
|
|
6338
6342
|
}
|
|
6339
|
-
function selectorInit(
|
|
6340
|
-
|
|
6343
|
+
function selectorInit(store2) {
|
|
6344
|
+
store2.getState().knownSelectors.add(key);
|
|
6341
6345
|
liveStoresCount++;
|
|
6342
6346
|
return () => {
|
|
6343
6347
|
liveStoresCount--;
|
|
@@ -6346,19 +6350,19 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6346
6350
|
function selectorShouldDeleteConfigOnRelease() {
|
|
6347
6351
|
return getConfigDeletionHandler$1(key) !== void 0 && !selectorIsLive();
|
|
6348
6352
|
}
|
|
6349
|
-
function resolveAsync(
|
|
6353
|
+
function resolveAsync(store2, state, executionID, loadable, depValues) {
|
|
6350
6354
|
setCache(state, loadable, depValues);
|
|
6351
|
-
notifyStoresOfResolvedAsync(
|
|
6355
|
+
notifyStoresOfResolvedAsync(store2, executionID);
|
|
6352
6356
|
}
|
|
6353
|
-
function notifyStoresOfResolvedAsync(
|
|
6354
|
-
if (isLatestExecution(
|
|
6355
|
-
clearExecutionInfo(
|
|
6357
|
+
function notifyStoresOfResolvedAsync(store2, executionID) {
|
|
6358
|
+
if (isLatestExecution(store2, executionID)) {
|
|
6359
|
+
clearExecutionInfo(store2);
|
|
6356
6360
|
}
|
|
6357
6361
|
notifyWaitingStores(executionID, true);
|
|
6358
6362
|
}
|
|
6359
|
-
function notifyStoresOfNewAsyncDep(
|
|
6360
|
-
if (isLatestExecution(
|
|
6361
|
-
const executionInfo = Recoil_nullthrows$1(getExecutionInfo(
|
|
6363
|
+
function notifyStoresOfNewAsyncDep(store2, executionID) {
|
|
6364
|
+
if (isLatestExecution(store2, executionID)) {
|
|
6365
|
+
const executionInfo = Recoil_nullthrows$1(getExecutionInfo(store2));
|
|
6362
6366
|
executionInfo.stateVersions.clear();
|
|
6363
6367
|
notifyWaitingStores(executionID, false);
|
|
6364
6368
|
}
|
|
@@ -6374,52 +6378,52 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6374
6378
|
}
|
|
6375
6379
|
}
|
|
6376
6380
|
}
|
|
6377
|
-
function markStoreWaitingForResolvedAsync(
|
|
6381
|
+
function markStoreWaitingForResolvedAsync(store2, executionID) {
|
|
6378
6382
|
let stores = waitingStores.get(executionID);
|
|
6379
6383
|
if (stores == null) {
|
|
6380
6384
|
waitingStores.set(executionID, stores = /* @__PURE__ */ new Set());
|
|
6381
6385
|
}
|
|
6382
|
-
stores.add(
|
|
6386
|
+
stores.add(store2);
|
|
6383
6387
|
}
|
|
6384
|
-
function wrapResultPromise(
|
|
6388
|
+
function wrapResultPromise(store2, promise, state, depValues, executionID, loadingDepsState) {
|
|
6385
6389
|
return promise.then((value) => {
|
|
6386
6390
|
if (!selectorIsLive()) {
|
|
6387
|
-
clearExecutionInfo(
|
|
6391
|
+
clearExecutionInfo(store2);
|
|
6388
6392
|
throw CANCELED;
|
|
6389
6393
|
}
|
|
6390
6394
|
const loadable = loadableWithValue$2(value);
|
|
6391
|
-
resolveAsync(
|
|
6395
|
+
resolveAsync(store2, state, executionID, loadable, depValues);
|
|
6392
6396
|
return value;
|
|
6393
6397
|
}).catch((errorOrPromise) => {
|
|
6394
6398
|
if (!selectorIsLive()) {
|
|
6395
|
-
clearExecutionInfo(
|
|
6399
|
+
clearExecutionInfo(store2);
|
|
6396
6400
|
throw CANCELED;
|
|
6397
6401
|
}
|
|
6398
6402
|
if (Recoil_isPromise(errorOrPromise)) {
|
|
6399
|
-
return wrapPendingDependencyPromise(
|
|
6403
|
+
return wrapPendingDependencyPromise(store2, errorOrPromise, state, depValues, executionID, loadingDepsState);
|
|
6400
6404
|
}
|
|
6401
6405
|
const loadable = loadableWithError$1(errorOrPromise);
|
|
6402
|
-
resolveAsync(
|
|
6406
|
+
resolveAsync(store2, state, executionID, loadable, depValues);
|
|
6403
6407
|
throw errorOrPromise;
|
|
6404
6408
|
});
|
|
6405
6409
|
}
|
|
6406
|
-
function wrapPendingDependencyPromise(
|
|
6410
|
+
function wrapPendingDependencyPromise(store2, promise, state, existingDeps, executionID, loadingDepsState) {
|
|
6407
6411
|
return promise.then((resolvedDep) => {
|
|
6408
6412
|
if (!selectorIsLive()) {
|
|
6409
|
-
clearExecutionInfo(
|
|
6413
|
+
clearExecutionInfo(store2);
|
|
6410
6414
|
throw CANCELED;
|
|
6411
6415
|
}
|
|
6412
6416
|
if (loadingDepsState.loadingDepKey != null && loadingDepsState.loadingDepPromise === promise) {
|
|
6413
6417
|
state.atomValues.set(loadingDepsState.loadingDepKey, loadableWithValue$2(resolvedDep));
|
|
6414
6418
|
} else {
|
|
6415
|
-
|
|
6419
|
+
store2.getState().knownSelectors.forEach((nodeKey) => {
|
|
6416
6420
|
state.atomValues.delete(nodeKey);
|
|
6417
6421
|
});
|
|
6418
6422
|
}
|
|
6419
|
-
const cachedLoadable = getLoadableFromCacheAndUpdateDeps(
|
|
6423
|
+
const cachedLoadable = getLoadableFromCacheAndUpdateDeps(store2, state);
|
|
6420
6424
|
if (cachedLoadable && cachedLoadable.state !== "loading") {
|
|
6421
|
-
if (isLatestExecution(
|
|
6422
|
-
notifyStoresOfResolvedAsync(
|
|
6425
|
+
if (isLatestExecution(store2, executionID) || getExecutionInfo(store2) == null) {
|
|
6426
|
+
notifyStoresOfResolvedAsync(store2, executionID);
|
|
6423
6427
|
}
|
|
6424
6428
|
if (cachedLoadable.state === "hasValue") {
|
|
6425
6429
|
return cachedLoadable.contents;
|
|
@@ -6427,15 +6431,15 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6427
6431
|
throw cachedLoadable.contents;
|
|
6428
6432
|
}
|
|
6429
6433
|
}
|
|
6430
|
-
if (!isLatestExecution(
|
|
6431
|
-
const executionInfo = getInProgressExecutionInfo(
|
|
6434
|
+
if (!isLatestExecution(store2, executionID)) {
|
|
6435
|
+
const executionInfo = getInProgressExecutionInfo(store2, state);
|
|
6432
6436
|
if (executionInfo != null) {
|
|
6433
6437
|
return executionInfo.loadingLoadable.contents;
|
|
6434
6438
|
}
|
|
6435
6439
|
}
|
|
6436
|
-
const [loadable, depValues] = evaluateSelectorGetter(
|
|
6440
|
+
const [loadable, depValues] = evaluateSelectorGetter(store2, state, executionID);
|
|
6437
6441
|
if (loadable.state !== "loading") {
|
|
6438
|
-
resolveAsync(
|
|
6442
|
+
resolveAsync(store2, state, executionID, loadable, depValues);
|
|
6439
6443
|
}
|
|
6440
6444
|
if (loadable.state === "hasError") {
|
|
6441
6445
|
throw loadable.contents;
|
|
@@ -6446,25 +6450,25 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6446
6450
|
throw CANCELED;
|
|
6447
6451
|
}
|
|
6448
6452
|
if (!selectorIsLive()) {
|
|
6449
|
-
clearExecutionInfo(
|
|
6453
|
+
clearExecutionInfo(store2);
|
|
6450
6454
|
throw CANCELED;
|
|
6451
6455
|
}
|
|
6452
6456
|
const loadable = loadableWithError$1(error);
|
|
6453
|
-
resolveAsync(
|
|
6457
|
+
resolveAsync(store2, state, executionID, loadable, existingDeps);
|
|
6454
6458
|
throw error;
|
|
6455
6459
|
});
|
|
6456
6460
|
}
|
|
6457
|
-
function updateDeps(
|
|
6461
|
+
function updateDeps(store2, state, deps, executionID) {
|
|
6458
6462
|
var _store$getState, _store$getState$curre, _store$getState2, _store$getState2$next;
|
|
6459
|
-
if (isLatestExecution(
|
|
6463
|
+
if (isLatestExecution(store2, executionID) || state.version === ((_store$getState = store2.getState()) === null || _store$getState === void 0 ? void 0 : (_store$getState$curre = _store$getState.currentTree) === null || _store$getState$curre === void 0 ? void 0 : _store$getState$curre.version) || state.version === ((_store$getState2 = store2.getState()) === null || _store$getState2 === void 0 ? void 0 : (_store$getState2$next = _store$getState2.nextTree) === null || _store$getState2$next === void 0 ? void 0 : _store$getState2$next.version)) {
|
|
6460
6464
|
var _store$getState$nextT, _store$getState3, _store$getState3$next;
|
|
6461
|
-
saveDepsToStore$1(key, deps,
|
|
6465
|
+
saveDepsToStore$1(key, deps, store2, (_store$getState$nextT = (_store$getState3 = store2.getState()) === null || _store$getState3 === void 0 ? void 0 : (_store$getState3$next = _store$getState3.nextTree) === null || _store$getState3$next === void 0 ? void 0 : _store$getState3$next.version) !== null && _store$getState$nextT !== void 0 ? _store$getState$nextT : store2.getState().currentTree.version);
|
|
6462
6466
|
}
|
|
6463
6467
|
for (const nodeKey of deps) {
|
|
6464
6468
|
discoveredDependencyNodeKeys.add(nodeKey);
|
|
6465
6469
|
}
|
|
6466
6470
|
}
|
|
6467
|
-
function evaluateSelectorGetter(
|
|
6471
|
+
function evaluateSelectorGetter(store2, state, executionID) {
|
|
6468
6472
|
const endPerfBlock = startPerfBlock$1(key);
|
|
6469
6473
|
let duringSynchronousExecution = true;
|
|
6470
6474
|
let duringAsynchronousExecution = true;
|
|
@@ -6483,11 +6487,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6483
6487
|
function getRecoilValue({
|
|
6484
6488
|
key: depKey
|
|
6485
6489
|
}) {
|
|
6486
|
-
const depLoadable = getNodeLoadable$2(
|
|
6490
|
+
const depLoadable = getNodeLoadable$2(store2, state, depKey);
|
|
6487
6491
|
depValues.set(depKey, depLoadable);
|
|
6488
6492
|
if (!duringSynchronousExecution) {
|
|
6489
|
-
updateDeps(
|
|
6490
|
-
notifyStoresOfNewAsyncDep(
|
|
6493
|
+
updateDeps(store2, state, new Set(depValues.keys()), executionID);
|
|
6494
|
+
notifyStoresOfNewAsyncDep(store2, executionID);
|
|
6491
6495
|
}
|
|
6492
6496
|
switch (depLoadable.state) {
|
|
6493
6497
|
case "hasValue":
|
|
@@ -6508,7 +6512,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6508
6512
|
}
|
|
6509
6513
|
!(recoilValue != null) ? Recoil_invariant(false) : void 0;
|
|
6510
6514
|
return recoilCallback$1(
|
|
6511
|
-
|
|
6515
|
+
store2,
|
|
6512
6516
|
fn,
|
|
6513
6517
|
args,
|
|
6514
6518
|
{
|
|
@@ -6530,7 +6534,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6530
6534
|
result = result.contents;
|
|
6531
6535
|
}
|
|
6532
6536
|
if (Recoil_isPromise(result)) {
|
|
6533
|
-
result = wrapResultPromise(
|
|
6537
|
+
result = wrapResultPromise(store2, result, state, depValues, executionID, loadingDepsState).finally(finishEvaluation);
|
|
6534
6538
|
} else {
|
|
6535
6539
|
finishEvaluation();
|
|
6536
6540
|
}
|
|
@@ -6538,7 +6542,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6538
6542
|
} catch (errorOrDepPromise) {
|
|
6539
6543
|
result = errorOrDepPromise;
|
|
6540
6544
|
if (Recoil_isPromise(result)) {
|
|
6541
|
-
result = wrapPendingDependencyPromise(
|
|
6545
|
+
result = wrapPendingDependencyPromise(store2, result, state, depValues, executionID, loadingDepsState).finally(finishEvaluation);
|
|
6542
6546
|
} else {
|
|
6543
6547
|
resultIsError = true;
|
|
6544
6548
|
finishEvaluation();
|
|
@@ -6552,11 +6556,11 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6552
6556
|
loadable = loadableWithValue$2(result);
|
|
6553
6557
|
}
|
|
6554
6558
|
duringSynchronousExecution = false;
|
|
6555
|
-
updateExecutionInfoDepValues(
|
|
6556
|
-
updateDeps(
|
|
6559
|
+
updateExecutionInfoDepValues(store2, executionID, depValues);
|
|
6560
|
+
updateDeps(store2, state, new Set(depValues.keys()), executionID);
|
|
6557
6561
|
return [loadable, depValues];
|
|
6558
6562
|
}
|
|
6559
|
-
function getLoadableFromCacheAndUpdateDeps(
|
|
6563
|
+
function getLoadableFromCacheAndUpdateDeps(store2, state) {
|
|
6560
6564
|
let cachedLoadable = state.atomValues.get(key);
|
|
6561
6565
|
if (cachedLoadable != null) {
|
|
6562
6566
|
return cachedLoadable;
|
|
@@ -6565,7 +6569,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6565
6569
|
try {
|
|
6566
6570
|
cachedLoadable = cache2.get((nodeKey) => {
|
|
6567
6571
|
!(typeof nodeKey === "string") ? false ? Recoil_invariant(false, "Cache nodeKey is type string") : Recoil_invariant(false) : void 0;
|
|
6568
|
-
return getNodeLoadable$2(
|
|
6572
|
+
return getNodeLoadable$2(store2, state, nodeKey).contents;
|
|
6569
6573
|
}, {
|
|
6570
6574
|
onNodeVisit: (node) => {
|
|
6571
6575
|
if (node.type === "branch" && node.nodeKey !== key) {
|
|
@@ -6579,40 +6583,40 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6579
6583
|
if (cachedLoadable) {
|
|
6580
6584
|
var _getExecutionInfo;
|
|
6581
6585
|
state.atomValues.set(key, cachedLoadable);
|
|
6582
|
-
updateDeps(
|
|
6586
|
+
updateDeps(store2, state, depsAfterCacheLookup, (_getExecutionInfo = getExecutionInfo(store2)) === null || _getExecutionInfo === void 0 ? void 0 : _getExecutionInfo.executionID);
|
|
6583
6587
|
}
|
|
6584
6588
|
return cachedLoadable;
|
|
6585
6589
|
}
|
|
6586
|
-
function getSelectorLoadableAndUpdateDeps(
|
|
6587
|
-
const cachedVal = getLoadableFromCacheAndUpdateDeps(
|
|
6590
|
+
function getSelectorLoadableAndUpdateDeps(store2, state) {
|
|
6591
|
+
const cachedVal = getLoadableFromCacheAndUpdateDeps(store2, state);
|
|
6588
6592
|
if (cachedVal != null) {
|
|
6589
|
-
clearExecutionInfo(
|
|
6593
|
+
clearExecutionInfo(store2);
|
|
6590
6594
|
return cachedVal;
|
|
6591
6595
|
}
|
|
6592
|
-
const inProgressExecutionInfo = getInProgressExecutionInfo(
|
|
6596
|
+
const inProgressExecutionInfo = getInProgressExecutionInfo(store2, state);
|
|
6593
6597
|
if (inProgressExecutionInfo != null) {
|
|
6594
6598
|
var _inProgressExecutionI;
|
|
6595
6599
|
if (((_inProgressExecutionI = inProgressExecutionInfo.loadingLoadable) === null || _inProgressExecutionI === void 0 ? void 0 : _inProgressExecutionI.state) === "loading") {
|
|
6596
|
-
markStoreWaitingForResolvedAsync(
|
|
6600
|
+
markStoreWaitingForResolvedAsync(store2, inProgressExecutionInfo.executionID);
|
|
6597
6601
|
}
|
|
6598
6602
|
return inProgressExecutionInfo.loadingLoadable;
|
|
6599
6603
|
}
|
|
6600
6604
|
const newExecutionID = getNewExecutionID();
|
|
6601
|
-
const [loadable, newDepValues] = evaluateSelectorGetter(
|
|
6605
|
+
const [loadable, newDepValues] = evaluateSelectorGetter(store2, state, newExecutionID);
|
|
6602
6606
|
if (loadable.state === "loading") {
|
|
6603
|
-
setExecutionInfo(
|
|
6604
|
-
markStoreWaitingForResolvedAsync(
|
|
6607
|
+
setExecutionInfo(store2, newExecutionID, loadable, newDepValues, state);
|
|
6608
|
+
markStoreWaitingForResolvedAsync(store2, newExecutionID);
|
|
6605
6609
|
} else {
|
|
6606
|
-
clearExecutionInfo(
|
|
6610
|
+
clearExecutionInfo(store2);
|
|
6607
6611
|
setCache(state, loadable, newDepValues);
|
|
6608
6612
|
}
|
|
6609
6613
|
return loadable;
|
|
6610
6614
|
}
|
|
6611
|
-
function getInProgressExecutionInfo(
|
|
6612
|
-
const pendingExecutions = Recoil_concatIterables([executionInfoMap.has(
|
|
6615
|
+
function getInProgressExecutionInfo(store2, state) {
|
|
6616
|
+
const pendingExecutions = Recoil_concatIterables([executionInfoMap.has(store2) ? [Recoil_nullthrows$1(executionInfoMap.get(store2))] : [], Recoil_mapIterable(Recoil_filterIterable(executionInfoMap, ([s]) => s !== store2), ([, execInfo]) => execInfo)]);
|
|
6613
6617
|
function anyDepChanged(execDepValues) {
|
|
6614
6618
|
for (const [depKey, execLoadable] of execDepValues) {
|
|
6615
|
-
if (!getNodeLoadable$2(
|
|
6619
|
+
if (!getNodeLoadable$2(store2, state, depKey).is(execLoadable)) {
|
|
6616
6620
|
return true;
|
|
6617
6621
|
}
|
|
6618
6622
|
}
|
|
@@ -6628,31 +6632,31 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6628
6632
|
}
|
|
6629
6633
|
return void 0;
|
|
6630
6634
|
}
|
|
6631
|
-
function getExecutionInfo(
|
|
6632
|
-
return executionInfoMap.get(
|
|
6635
|
+
function getExecutionInfo(store2) {
|
|
6636
|
+
return executionInfoMap.get(store2);
|
|
6633
6637
|
}
|
|
6634
|
-
function setExecutionInfo(
|
|
6635
|
-
executionInfoMap.set(
|
|
6638
|
+
function setExecutionInfo(store2, newExecutionID, loadable, depValues, state) {
|
|
6639
|
+
executionInfoMap.set(store2, {
|
|
6636
6640
|
depValuesDiscoveredSoFarDuringAsyncWork: depValues,
|
|
6637
6641
|
executionID: newExecutionID,
|
|
6638
6642
|
loadingLoadable: loadable,
|
|
6639
6643
|
stateVersions: /* @__PURE__ */ new Map([[state.version, true]])
|
|
6640
6644
|
});
|
|
6641
6645
|
}
|
|
6642
|
-
function updateExecutionInfoDepValues(
|
|
6643
|
-
if (isLatestExecution(
|
|
6644
|
-
const executionInfo = getExecutionInfo(
|
|
6646
|
+
function updateExecutionInfoDepValues(store2, executionID, depValues) {
|
|
6647
|
+
if (isLatestExecution(store2, executionID)) {
|
|
6648
|
+
const executionInfo = getExecutionInfo(store2);
|
|
6645
6649
|
if (executionInfo != null) {
|
|
6646
6650
|
executionInfo.depValuesDiscoveredSoFarDuringAsyncWork = depValues;
|
|
6647
6651
|
}
|
|
6648
6652
|
}
|
|
6649
6653
|
}
|
|
6650
|
-
function clearExecutionInfo(
|
|
6651
|
-
executionInfoMap.delete(
|
|
6654
|
+
function clearExecutionInfo(store2) {
|
|
6655
|
+
executionInfoMap.delete(store2);
|
|
6652
6656
|
}
|
|
6653
|
-
function isLatestExecution(
|
|
6657
|
+
function isLatestExecution(store2, executionID) {
|
|
6654
6658
|
var _getExecutionInfo2;
|
|
6655
|
-
return executionID === ((_getExecutionInfo2 = getExecutionInfo(
|
|
6659
|
+
return executionID === ((_getExecutionInfo2 = getExecutionInfo(store2)) === null || _getExecutionInfo2 === void 0 ? void 0 : _getExecutionInfo2.executionID);
|
|
6656
6660
|
}
|
|
6657
6661
|
function depValuesToDepRoute(depValues) {
|
|
6658
6662
|
return Array.from(depValues.entries()).map(([depKey, valLoadable]) => [depKey, valLoadable.contents]);
|
|
@@ -6677,7 +6681,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6677
6681
|
dependencyStack.pop();
|
|
6678
6682
|
}
|
|
6679
6683
|
}
|
|
6680
|
-
function selectorPeek(
|
|
6684
|
+
function selectorPeek(store2, state) {
|
|
6681
6685
|
const cachedLoadable = state.atomValues.get(key);
|
|
6682
6686
|
if (cachedLoadable != null) {
|
|
6683
6687
|
return cachedLoadable;
|
|
@@ -6685,29 +6689,29 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6685
6689
|
return cache2.get((nodeKey) => {
|
|
6686
6690
|
var _peekNodeLoadable;
|
|
6687
6691
|
!(typeof nodeKey === "string") ? Recoil_invariant(false) : void 0;
|
|
6688
|
-
return (_peekNodeLoadable = peekNodeLoadable$1(
|
|
6692
|
+
return (_peekNodeLoadable = peekNodeLoadable$1(store2, state, nodeKey)) === null || _peekNodeLoadable === void 0 ? void 0 : _peekNodeLoadable.contents;
|
|
6689
6693
|
});
|
|
6690
6694
|
}
|
|
6691
|
-
function selectorGet(
|
|
6692
|
-
return detectCircularDependencies(() => getSelectorLoadableAndUpdateDeps(
|
|
6695
|
+
function selectorGet(store2, state) {
|
|
6696
|
+
return detectCircularDependencies(() => getSelectorLoadableAndUpdateDeps(store2, state));
|
|
6693
6697
|
}
|
|
6694
6698
|
function invalidateSelector(state) {
|
|
6695
6699
|
state.atomValues.delete(key);
|
|
6696
6700
|
}
|
|
6697
|
-
function clearSelectorCache(
|
|
6701
|
+
function clearSelectorCache(store2, treeState) {
|
|
6698
6702
|
!(recoilValue != null) ? Recoil_invariant(false) : void 0;
|
|
6699
6703
|
for (const nodeKey of discoveredDependencyNodeKeys) {
|
|
6700
6704
|
var _node$clearCache;
|
|
6701
6705
|
const node = getNode$6(nodeKey);
|
|
6702
|
-
(_node$clearCache = node.clearCache) === null || _node$clearCache === void 0 ? void 0 : _node$clearCache.call(node,
|
|
6706
|
+
(_node$clearCache = node.clearCache) === null || _node$clearCache === void 0 ? void 0 : _node$clearCache.call(node, store2, treeState);
|
|
6703
6707
|
}
|
|
6704
6708
|
discoveredDependencyNodeKeys.clear();
|
|
6705
6709
|
invalidateSelector(treeState);
|
|
6706
6710
|
cache2.clear();
|
|
6707
|
-
markRecoilValueModified$1(
|
|
6711
|
+
markRecoilValueModified$1(store2, recoilValue);
|
|
6708
6712
|
}
|
|
6709
6713
|
if (set2 != null) {
|
|
6710
|
-
const selectorSet = (
|
|
6714
|
+
const selectorSet = (store2, state, newValue) => {
|
|
6711
6715
|
let syncSelectorSetFinished = false;
|
|
6712
6716
|
const writes = /* @__PURE__ */ new Map();
|
|
6713
6717
|
function getRecoilValue({
|
|
@@ -6716,7 +6720,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6716
6720
|
if (syncSelectorSetFinished) {
|
|
6717
6721
|
throw Recoil_err$2("Recoil: Async selector sets are not currently supported.");
|
|
6718
6722
|
}
|
|
6719
|
-
const loadable = getNodeLoadable$2(
|
|
6723
|
+
const loadable = getNodeLoadable$2(store2, state, depKey);
|
|
6720
6724
|
if (loadable.state === "hasValue") {
|
|
6721
6725
|
return loadable.contents;
|
|
6722
6726
|
} else if (loadable.state === "loading") {
|
|
@@ -6732,7 +6736,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6732
6736
|
throw Recoil_err$2(msg);
|
|
6733
6737
|
}
|
|
6734
6738
|
const setValue = typeof valueOrUpdater === "function" ? valueOrUpdater(getRecoilValue(recoilState)) : valueOrUpdater;
|
|
6735
|
-
const upstreamWrites = setNodeValue$3(
|
|
6739
|
+
const upstreamWrites = setNodeValue$3(store2, state, recoilState.key, setValue);
|
|
6736
6740
|
upstreamWrites.forEach((v2, k2) => writes.set(k2, v2));
|
|
6737
6741
|
}
|
|
6738
6742
|
function resetRecoilState(recoilState) {
|
|
@@ -6836,40 +6840,40 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6836
6840
|
function maybeFreezeValueOrPromise(valueOrPromise) {
|
|
6837
6841
|
return valueOrPromise;
|
|
6838
6842
|
}
|
|
6839
|
-
function wrapPendingPromise(
|
|
6843
|
+
function wrapPendingPromise(store2, promise) {
|
|
6840
6844
|
const wrappedPromise = promise.then((value) => {
|
|
6841
6845
|
var _store$getState$nextT, _state$atomValues$get;
|
|
6842
|
-
const state = (_store$getState$nextT =
|
|
6846
|
+
const state = (_store$getState$nextT = store2.getState().nextTree) !== null && _store$getState$nextT !== void 0 ? _store$getState$nextT : store2.getState().currentTree;
|
|
6843
6847
|
if (((_state$atomValues$get = state.atomValues.get(key)) === null || _state$atomValues$get === void 0 ? void 0 : _state$atomValues$get.contents) === wrappedPromise) {
|
|
6844
|
-
setRecoilValue$4(
|
|
6848
|
+
setRecoilValue$4(store2, node, value);
|
|
6845
6849
|
}
|
|
6846
6850
|
return value;
|
|
6847
6851
|
}).catch((error) => {
|
|
6848
6852
|
var _store$getState$nextT2, _state$atomValues$get2;
|
|
6849
|
-
const state = (_store$getState$nextT2 =
|
|
6853
|
+
const state = (_store$getState$nextT2 = store2.getState().nextTree) !== null && _store$getState$nextT2 !== void 0 ? _store$getState$nextT2 : store2.getState().currentTree;
|
|
6850
6854
|
if (((_state$atomValues$get2 = state.atomValues.get(key)) === null || _state$atomValues$get2 === void 0 ? void 0 : _state$atomValues$get2.contents) === wrappedPromise) {
|
|
6851
|
-
setRecoilValueLoadable$2(
|
|
6855
|
+
setRecoilValueLoadable$2(store2, node, loadableWithError$2(error));
|
|
6852
6856
|
}
|
|
6853
6857
|
throw error;
|
|
6854
6858
|
});
|
|
6855
6859
|
return wrappedPromise;
|
|
6856
6860
|
}
|
|
6857
|
-
function initAtom(
|
|
6861
|
+
function initAtom(store2, initState, trigger) {
|
|
6858
6862
|
var _options$effects;
|
|
6859
6863
|
liveStoresCount++;
|
|
6860
6864
|
const cleanupAtom = () => {
|
|
6861
6865
|
var _cleanupEffectsByStor;
|
|
6862
6866
|
liveStoresCount--;
|
|
6863
|
-
(_cleanupEffectsByStor = cleanupEffectsByStore.get(
|
|
6864
|
-
cleanupEffectsByStore.delete(
|
|
6867
|
+
(_cleanupEffectsByStor = cleanupEffectsByStore.get(store2)) === null || _cleanupEffectsByStor === void 0 ? void 0 : _cleanupEffectsByStor.forEach((cleanup) => cleanup());
|
|
6868
|
+
cleanupEffectsByStore.delete(store2);
|
|
6865
6869
|
};
|
|
6866
|
-
|
|
6870
|
+
store2.getState().knownAtoms.add(key);
|
|
6867
6871
|
if (defaultLoadable.state === "loading") {
|
|
6868
6872
|
const notifyDefaultSubscribers = () => {
|
|
6869
6873
|
var _store$getState$nextT3;
|
|
6870
|
-
const state = (_store$getState$nextT3 =
|
|
6874
|
+
const state = (_store$getState$nextT3 = store2.getState().nextTree) !== null && _store$getState$nextT3 !== void 0 ? _store$getState$nextT3 : store2.getState().currentTree;
|
|
6871
6875
|
if (!state.atomValues.has(key)) {
|
|
6872
|
-
markRecoilValueModified$2(
|
|
6876
|
+
markRecoilValueModified$2(store2, node);
|
|
6873
6877
|
}
|
|
6874
6878
|
};
|
|
6875
6879
|
defaultLoadable.contents.finally(notifyDefaultSubscribers);
|
|
@@ -6879,14 +6883,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6879
6883
|
let getLoadable = function(recoilValue) {
|
|
6880
6884
|
if (isDuringInit && recoilValue.key === key) {
|
|
6881
6885
|
const retValue = initValue;
|
|
6882
|
-
return retValue instanceof DefaultValue$2$1 ? peekAtom(
|
|
6886
|
+
return retValue instanceof DefaultValue$2$1 ? peekAtom(store2, initState) : Recoil_isPromise(retValue) ? loadableWithPromise$2(retValue.then((v2) => v2 instanceof DefaultValue$2$1 ? defaultLoadable.toPromise() : v2)) : loadableWithValue$3(retValue);
|
|
6883
6887
|
}
|
|
6884
|
-
return getRecoilValueAsLoadable$4(
|
|
6888
|
+
return getRecoilValueAsLoadable$4(store2, recoilValue);
|
|
6885
6889
|
}, getPromise = function(recoilValue) {
|
|
6886
6890
|
return getLoadable(recoilValue).toPromise();
|
|
6887
6891
|
}, getInfo_UNSTABLE = function(recoilValue) {
|
|
6888
6892
|
var _store$getState$nextT4;
|
|
6889
|
-
const info = peekNodeInfo$3(
|
|
6893
|
+
const info = peekNodeInfo$3(store2, (_store$getState$nextT4 = store2.getState().nextTree) !== null && _store$getState$nextT4 !== void 0 ? _store$getState$nextT4 : store2.getState().currentTree, recoilValue.key);
|
|
6890
6894
|
return isDuringInit && recoilValue.key === key && !(initValue instanceof DefaultValue$2$1) ? {
|
|
6891
6895
|
...info,
|
|
6892
6896
|
isSet: true,
|
|
@@ -6921,7 +6925,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6921
6925
|
value: unwrap(valueOrUpdater)
|
|
6922
6926
|
};
|
|
6923
6927
|
}
|
|
6924
|
-
setRecoilValue$4(
|
|
6928
|
+
setRecoilValue$4(store2, node, typeof valueOrUpdater === "function" ? (currentValue) => {
|
|
6925
6929
|
const newValue = unwrap(
|
|
6926
6930
|
valueOrUpdater(currentValue)
|
|
6927
6931
|
);
|
|
@@ -6938,7 +6942,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6938
6942
|
var _cleanupEffectsByStor2;
|
|
6939
6943
|
const {
|
|
6940
6944
|
release
|
|
6941
|
-
} =
|
|
6945
|
+
} = store2.subscribeToTransactions((currentStore) => {
|
|
6942
6946
|
var _currentTree$atomValu;
|
|
6943
6947
|
let {
|
|
6944
6948
|
currentTree,
|
|
@@ -6960,14 +6964,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6960
6964
|
}
|
|
6961
6965
|
}
|
|
6962
6966
|
}, key);
|
|
6963
|
-
cleanupEffectsByStore.set(
|
|
6967
|
+
cleanupEffectsByStore.set(store2, [...(_cleanupEffectsByStor2 = cleanupEffectsByStore.get(store2)) !== null && _cleanupEffectsByStor2 !== void 0 ? _cleanupEffectsByStor2 : [], release]);
|
|
6964
6968
|
};
|
|
6965
6969
|
for (const effect2 of effects) {
|
|
6966
6970
|
try {
|
|
6967
6971
|
const cleanup = effect2({
|
|
6968
6972
|
node,
|
|
6969
|
-
storeID:
|
|
6970
|
-
parentStoreID_UNSTABLE:
|
|
6973
|
+
storeID: store2.storeID,
|
|
6974
|
+
parentStoreID_UNSTABLE: store2.parentStoreID,
|
|
6971
6975
|
trigger,
|
|
6972
6976
|
setSelf: setSelf(effect2),
|
|
6973
6977
|
resetSelf: resetSelf(effect2),
|
|
@@ -6978,7 +6982,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6978
6982
|
});
|
|
6979
6983
|
if (cleanup != null) {
|
|
6980
6984
|
var _cleanupEffectsByStor3;
|
|
6981
|
-
cleanupEffectsByStore.set(
|
|
6985
|
+
cleanupEffectsByStore.set(store2, [...(_cleanupEffectsByStor3 = cleanupEffectsByStore.get(store2)) !== null && _cleanupEffectsByStor3 !== void 0 ? _cleanupEffectsByStor3 : [], cleanup]);
|
|
6982
6986
|
}
|
|
6983
6987
|
} catch (error) {
|
|
6984
6988
|
initValue = error;
|
|
@@ -6988,10 +6992,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
6988
6992
|
isDuringInit = false;
|
|
6989
6993
|
if (!(initValue instanceof DefaultValue$2$1)) {
|
|
6990
6994
|
var _store$getState$nextT5;
|
|
6991
|
-
const initLoadable = isInitError ? loadableWithError$2(initValue) : Recoil_isPromise(initValue) ? loadableWithPromise$2(wrapPendingPromise(
|
|
6995
|
+
const initLoadable = isInitError ? loadableWithError$2(initValue) : Recoil_isPromise(initValue) ? loadableWithPromise$2(wrapPendingPromise(store2, initValue)) : loadableWithValue$3(unwrap(initValue));
|
|
6992
6996
|
maybeFreezeValueOrPromise(initLoadable.contents);
|
|
6993
6997
|
initState.atomValues.set(key, initLoadable);
|
|
6994
|
-
(_store$getState$nextT5 =
|
|
6998
|
+
(_store$getState$nextT5 = store2.getState().nextTree) === null || _store$getState$nextT5 === void 0 ? void 0 : _store$getState$nextT5.atomValues.set(key, initLoadable);
|
|
6995
6999
|
}
|
|
6996
7000
|
}
|
|
6997
7001
|
return cleanupAtom;
|
|
@@ -49396,7 +49400,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
49396
49400
|
key: "render",
|
|
49397
49401
|
value: function render2() {
|
|
49398
49402
|
var _props = this.props, children = _props.children, className = _props.className, disableHeight = _props.disableHeight, disableWidth = _props.disableWidth, style = _props.style;
|
|
49399
|
-
var
|
|
49403
|
+
var _state2 = this.state, height = _state2.height, width = _state2.width;
|
|
49400
49404
|
var outerStyle = { overflow: "visible" };
|
|
49401
49405
|
var childParams = {};
|
|
49402
49406
|
var bailoutOnChildren = false;
|
|
@@ -54952,13 +54956,85 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54952
54956
|
return baseClone$1(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG$1);
|
|
54953
54957
|
}
|
|
54954
54958
|
var cloneDeep_1 = cloneDeep;
|
|
54959
|
+
class GlobalStore {
|
|
54960
|
+
constructor() {
|
|
54961
|
+
__privateAdd(this, _notify);
|
|
54962
|
+
__privateAdd(this, _state, void 0);
|
|
54963
|
+
__privateAdd(this, _locks, void 0);
|
|
54964
|
+
__privateAdd(this, _subscribers, void 0);
|
|
54965
|
+
__privateSet(this, _state, {});
|
|
54966
|
+
__privateSet(this, _locks, {});
|
|
54967
|
+
__privateSet(this, _subscribers, {});
|
|
54968
|
+
}
|
|
54969
|
+
clear() {
|
|
54970
|
+
__privateSet(this, _state, {});
|
|
54971
|
+
__privateSet(this, _locks, {});
|
|
54972
|
+
__privateSet(this, _subscribers, {});
|
|
54973
|
+
}
|
|
54974
|
+
async getValue(key) {
|
|
54975
|
+
if (__privateGet(this, _locks)[key]) {
|
|
54976
|
+
return __privateGet(this, _locks)[key];
|
|
54977
|
+
}
|
|
54978
|
+
return __privateGet(this, _state)[key];
|
|
54979
|
+
}
|
|
54980
|
+
getValueSync(key) {
|
|
54981
|
+
return __privateGet(this, _state)[key];
|
|
54982
|
+
}
|
|
54983
|
+
setValue(key, value) {
|
|
54984
|
+
__privateMethod(this, _notify, notify_fn).call(this, key, value);
|
|
54985
|
+
__privateGet(this, _state)[key] = value;
|
|
54986
|
+
}
|
|
54987
|
+
async replaceValue(key, fn) {
|
|
54988
|
+
if (__privateGet(this, _locks)[key]) {
|
|
54989
|
+
return __privateGet(this, _locks)[key];
|
|
54990
|
+
}
|
|
54991
|
+
let unlock;
|
|
54992
|
+
let unlockError;
|
|
54993
|
+
const lockPromise = new Promise((resolve, reject) => {
|
|
54994
|
+
unlock = resolve;
|
|
54995
|
+
unlockError = reject;
|
|
54996
|
+
});
|
|
54997
|
+
__privateGet(this, _locks)[key] = lockPromise;
|
|
54998
|
+
let result;
|
|
54999
|
+
try {
|
|
55000
|
+
result = await fn();
|
|
55001
|
+
__privateGet(this, _state)[key] = result;
|
|
55002
|
+
__privateMethod(this, _notify, notify_fn).call(this, key, result);
|
|
55003
|
+
unlock(result);
|
|
55004
|
+
this.setValue(key, result);
|
|
55005
|
+
} catch (e3) {
|
|
55006
|
+
unlockError(e3);
|
|
55007
|
+
} finally {
|
|
55008
|
+
delete __privateGet(this, _locks)[key];
|
|
55009
|
+
}
|
|
55010
|
+
return lockPromise;
|
|
55011
|
+
}
|
|
55012
|
+
subscribe(key, callback) {
|
|
55013
|
+
if (!__privateGet(this, _subscribers)[key]) {
|
|
55014
|
+
__privateGet(this, _subscribers)[key] = [];
|
|
55015
|
+
}
|
|
55016
|
+
__privateGet(this, _subscribers)[key].push(callback);
|
|
55017
|
+
return () => {
|
|
55018
|
+
__privateGet(this, _subscribers)[key] = __privateGet(this, _subscribers)[key].filter((cb) => cb !== callback);
|
|
55019
|
+
};
|
|
55020
|
+
}
|
|
55021
|
+
}
|
|
55022
|
+
_state = new WeakMap();
|
|
55023
|
+
_locks = new WeakMap();
|
|
55024
|
+
_subscribers = new WeakMap();
|
|
55025
|
+
_notify = new WeakSet();
|
|
55026
|
+
notify_fn = function(key, value) {
|
|
55027
|
+
if (__privateGet(this, _subscribers)[key]) {
|
|
55028
|
+
__privateGet(this, _subscribers)[key].forEach((cb) => cb(value));
|
|
55029
|
+
}
|
|
55030
|
+
};
|
|
55031
|
+
const store = new GlobalStore();
|
|
54955
55032
|
class RequestExtrasSerializable {
|
|
54956
55033
|
constructor(extras) {
|
|
54957
55034
|
__publicField(this, "extras");
|
|
54958
55035
|
this.extras = extras;
|
|
54959
55036
|
}
|
|
54960
55037
|
toSerializable() {
|
|
54961
|
-
var _a;
|
|
54962
55038
|
if (!this.extras) {
|
|
54963
55039
|
return null;
|
|
54964
55040
|
}
|
|
@@ -54966,9 +55042,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54966
55042
|
return this.extras;
|
|
54967
55043
|
}
|
|
54968
55044
|
const serializable = cloneDeep_1(this.extras);
|
|
54969
|
-
if (
|
|
54970
|
-
const headers = new Headers(serializable.
|
|
54971
|
-
serializable.
|
|
55045
|
+
if (serializable == null ? void 0 : serializable.headers) {
|
|
55046
|
+
const headers = new Headers(serializable.headers);
|
|
55047
|
+
serializable.headers = Object.fromEntries(headers.entries());
|
|
54972
55048
|
}
|
|
54973
55049
|
return serializable;
|
|
54974
55050
|
}
|
|
@@ -54982,8 +55058,8 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54982
55058
|
}
|
|
54983
55059
|
async function request(url, options, extras) {
|
|
54984
55060
|
var _a, _b;
|
|
54985
|
-
const sessionToken =
|
|
54986
|
-
const mergedOptions = extras
|
|
55061
|
+
const sessionToken = await store.getValue("sessionToken");
|
|
55062
|
+
const mergedOptions = extras ? { ...options, ...extras } : options;
|
|
54987
55063
|
const { headers, ...other } = mergedOptions;
|
|
54988
55064
|
const headersInterface = new Headers(headers);
|
|
54989
55065
|
if (!headersInterface.has("Accept")) {
|
|
@@ -54997,18 +55073,35 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54997
55073
|
}
|
|
54998
55074
|
const baseUrl = (_b = (_a = window.dara) == null ? void 0 : _a.base_url) != null ? _b : "";
|
|
54999
55075
|
const urlString = url instanceof URL ? url.pathname + url.search : url;
|
|
55000
|
-
|
|
55076
|
+
const response = await fetch(baseUrl + urlString, {
|
|
55001
55077
|
headers: headersInterface,
|
|
55002
55078
|
...other
|
|
55003
55079
|
});
|
|
55004
|
-
|
|
55005
|
-
|
|
55006
|
-
|
|
55007
|
-
|
|
55008
|
-
|
|
55009
|
-
|
|
55010
|
-
|
|
55011
|
-
|
|
55080
|
+
if (response.status === 401 || response.status === 403) {
|
|
55081
|
+
try {
|
|
55082
|
+
const refreshedToken = await store.replaceValue("sessionToken", async () => {
|
|
55083
|
+
const refreshResponse = await fetch(`${baseUrl}/api/auth/refresh-token`, {
|
|
55084
|
+
headers: headersInterface,
|
|
55085
|
+
...other,
|
|
55086
|
+
method: "POST"
|
|
55087
|
+
});
|
|
55088
|
+
if (refreshResponse.ok) {
|
|
55089
|
+
const { token } = await refreshResponse.json();
|
|
55090
|
+
return token;
|
|
55091
|
+
}
|
|
55092
|
+
await validateResponse(refreshResponse, "Request auth error, failed to refresh the session token");
|
|
55093
|
+
});
|
|
55094
|
+
headersInterface.set("Authorization", `Bearer ${refreshedToken}`);
|
|
55095
|
+
return fetch(baseUrl + urlString, {
|
|
55096
|
+
headers: headersInterface,
|
|
55097
|
+
...other
|
|
55098
|
+
});
|
|
55099
|
+
} catch (e3) {
|
|
55100
|
+
console.error("Failed to refresh token", e3);
|
|
55101
|
+
return response;
|
|
55102
|
+
}
|
|
55103
|
+
}
|
|
55104
|
+
return response;
|
|
55012
55105
|
}
|
|
55013
55106
|
const directionCtx = React.createContext({ direction: "row" });
|
|
55014
55107
|
const importersCtx = React.createContext({});
|
|
@@ -55930,14 +56023,10 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55930
56023
|
}
|
|
55931
56024
|
const requestExtrasCtx = React.createContext({ options: {} });
|
|
55932
56025
|
function useRequestExtras() {
|
|
55933
|
-
const sessionToken = useSessionToken();
|
|
55934
56026
|
const { options } = React.useContext(requestExtrasCtx);
|
|
55935
56027
|
const extras = React.useMemo(() => {
|
|
55936
|
-
return
|
|
55937
|
-
|
|
55938
|
-
sessionToken
|
|
55939
|
-
};
|
|
55940
|
-
}, [useDeepCompare(options), sessionToken]);
|
|
56028
|
+
return options;
|
|
56029
|
+
}, [useDeepCompare(options)]);
|
|
55941
56030
|
return extras;
|
|
55942
56031
|
}
|
|
55943
56032
|
function RequestExtrasProvider({
|
|
@@ -56064,23 +56153,17 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
56064
56153
|
{ refetchOnWindowFocus: false }
|
|
56065
56154
|
);
|
|
56066
56155
|
}
|
|
56067
|
-
async function revokeSession(
|
|
56068
|
-
|
|
56069
|
-
|
|
56070
|
-
|
|
56071
|
-
|
|
56072
|
-
|
|
56073
|
-
|
|
56074
|
-
|
|
56075
|
-
token
|
|
56076
|
-
);
|
|
56077
|
-
if (response.ok) {
|
|
56078
|
-
const responseData = await response.json();
|
|
56079
|
-
return responseData;
|
|
56080
|
-
}
|
|
56081
|
-
} catch (e3) {
|
|
56082
|
-
console.error("Failed to revoke session", e3);
|
|
56156
|
+
async function revokeSession() {
|
|
56157
|
+
try {
|
|
56158
|
+
const response = await request("/api/auth/revoke-session", {
|
|
56159
|
+
method: HTTP_METHOD.POST
|
|
56160
|
+
});
|
|
56161
|
+
if (response.ok) {
|
|
56162
|
+
const responseData = await response.json();
|
|
56163
|
+
return responseData;
|
|
56083
56164
|
}
|
|
56165
|
+
} catch (e3) {
|
|
56166
|
+
console.error("Failed to revoke session", e3);
|
|
56084
56167
|
}
|
|
56085
56168
|
}
|
|
56086
56169
|
async function handleAuthErrors(res, toLogin = false, ignoreErrors = null) {
|
|
@@ -56109,7 +56192,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
56109
56192
|
refetchOnWindowFocus: false
|
|
56110
56193
|
});
|
|
56111
56194
|
}
|
|
56112
|
-
async function
|
|
56195
|
+
async function requestSessionToken(body = {}) {
|
|
56113
56196
|
const res = await request("/api/auth/session", {
|
|
56114
56197
|
body: JSON.stringify(body),
|
|
56115
56198
|
method: HTTP_METHOD.POST
|
|
@@ -56124,14 +56207,10 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
56124
56207
|
localStorage.setItem(getTokenKey(), token);
|
|
56125
56208
|
return token;
|
|
56126
56209
|
}
|
|
56127
|
-
async function verifySessionToken(
|
|
56128
|
-
const res = await request(
|
|
56129
|
-
|
|
56130
|
-
|
|
56131
|
-
method: HTTP_METHOD.POST
|
|
56132
|
-
},
|
|
56133
|
-
token
|
|
56134
|
-
);
|
|
56210
|
+
async function verifySessionToken() {
|
|
56211
|
+
const res = await request("/api/auth/verify-session", {
|
|
56212
|
+
method: HTTP_METHOD.POST
|
|
56213
|
+
});
|
|
56135
56214
|
return res.ok;
|
|
56136
56215
|
}
|
|
56137
56216
|
function isPlaceholder(value) {
|
|
@@ -58015,6 +58094,18 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
58015
58094
|
}
|
|
58016
58095
|
return resolver(getOrRegisterPlainVariable(variable, client, taskContext, extras));
|
|
58017
58096
|
}
|
|
58097
|
+
function tokenSubscribe(cb) {
|
|
58098
|
+
return store.subscribe("sessionToken", cb);
|
|
58099
|
+
}
|
|
58100
|
+
function getSessionToken() {
|
|
58101
|
+
return store.getValueSync("sessionToken");
|
|
58102
|
+
}
|
|
58103
|
+
function setSessionToken(token) {
|
|
58104
|
+
store.setValue("sessionToken", token);
|
|
58105
|
+
}
|
|
58106
|
+
function useSessionToken() {
|
|
58107
|
+
return React__namespace.useSyncExternalStore(tokenSubscribe, getSessionToken);
|
|
58108
|
+
}
|
|
58018
58109
|
const STORE_EXTRAS_MAP = /* @__PURE__ */ new Map();
|
|
58019
58110
|
function BackendStoreSync({ children }) {
|
|
58020
58111
|
const { client } = React__namespace.useContext(websocketCtx);
|
|
@@ -58072,55 +58163,44 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
58072
58163
|
storeKey: "BackendStore"
|
|
58073
58164
|
});
|
|
58074
58165
|
}
|
|
58075
|
-
function getSessionKey(
|
|
58076
|
-
const sessionToken = typeof extras === "string" ? extras : extras.sessionToken;
|
|
58166
|
+
function getSessionKey(uid2) {
|
|
58077
58167
|
if (isEmbedded()) {
|
|
58078
58168
|
return `dara-session-${window.frameElement.dataset.daraPageId}-var-${uid2}`;
|
|
58079
58169
|
}
|
|
58080
|
-
return `dara-session-${
|
|
58170
|
+
return `dara-session-${getSessionToken()}-var-${uid2}`;
|
|
58081
58171
|
}
|
|
58082
58172
|
function BrowserStoreSync({ children }) {
|
|
58083
|
-
const
|
|
58084
|
-
|
|
58085
|
-
(itemKey)
|
|
58173
|
+
const getStoreValue = React__namespace.useCallback((itemKey) => {
|
|
58174
|
+
var _a;
|
|
58175
|
+
const key = getSessionKey(itemKey);
|
|
58176
|
+
return JSON.parse((_a = localStorage.getItem(key)) != null ? _a : "null");
|
|
58177
|
+
}, []);
|
|
58178
|
+
const syncStoreValues = React__namespace.useCallback(({ diff }) => {
|
|
58179
|
+
for (const [itemKey, value] of diff.entries()) {
|
|
58180
|
+
const key = getSessionKey(itemKey);
|
|
58181
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
58182
|
+
}
|
|
58183
|
+
}, []);
|
|
58184
|
+
const listenToStoreChanges = React__namespace.useCallback(({ updateItem }) => {
|
|
58185
|
+
const listener2 = (e3) => {
|
|
58086
58186
|
var _a;
|
|
58087
|
-
|
|
58088
|
-
|
|
58089
|
-
|
|
58090
|
-
|
|
58091
|
-
|
|
58092
|
-
|
|
58093
|
-
|
|
58094
|
-
for (const [itemKey, value] of diff.entries()) {
|
|
58095
|
-
const key = getSessionKey(extras, itemKey);
|
|
58096
|
-
localStorage.setItem(key, JSON.stringify(value));
|
|
58097
|
-
}
|
|
58098
|
-
},
|
|
58099
|
-
[extras]
|
|
58100
|
-
);
|
|
58101
|
-
const listenToStoreChanges = React__namespace.useCallback(
|
|
58102
|
-
({ updateItem }) => {
|
|
58103
|
-
const listener2 = (e3) => {
|
|
58104
|
-
var _a;
|
|
58105
|
-
if (e3.storageArea === localStorage) {
|
|
58106
|
-
if (e3.key) {
|
|
58107
|
-
const match2 = e3.key.match(/^dara-session-(.*)-var-(.*)$/);
|
|
58108
|
-
if (match2) {
|
|
58109
|
-
const [, sessionToken, uid2] = match2;
|
|
58110
|
-
if (typeof extras === "string" && sessionToken === extras || typeof extras === "object" && extras.sessionToken === sessionToken) {
|
|
58111
|
-
updateItem(uid2, JSON.parse((_a = e3.newValue) != null ? _a : "null"));
|
|
58112
|
-
}
|
|
58187
|
+
if (e3.storageArea === localStorage) {
|
|
58188
|
+
if (e3.key) {
|
|
58189
|
+
const match2 = e3.key.match(/^dara-session-(.*)-var-(.*)$/);
|
|
58190
|
+
if (match2) {
|
|
58191
|
+
const [, sessionToken, uid2] = match2;
|
|
58192
|
+
if (sessionToken === getSessionToken()) {
|
|
58193
|
+
updateItem(uid2, JSON.parse((_a = e3.newValue) != null ? _a : "null"));
|
|
58113
58194
|
}
|
|
58114
58195
|
}
|
|
58115
58196
|
}
|
|
58116
|
-
}
|
|
58117
|
-
|
|
58118
|
-
|
|
58119
|
-
|
|
58120
|
-
|
|
58121
|
-
}
|
|
58122
|
-
|
|
58123
|
-
);
|
|
58197
|
+
}
|
|
58198
|
+
};
|
|
58199
|
+
window.addEventListener("storage", listener2);
|
|
58200
|
+
return () => {
|
|
58201
|
+
window.removeEventListener("storage", listener2);
|
|
58202
|
+
};
|
|
58203
|
+
}, []);
|
|
58124
58204
|
return /* @__PURE__ */ React__namespace.createElement(RecoilSync_index_1, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "BrowserStore", write: syncStoreValues }, children);
|
|
58125
58205
|
}
|
|
58126
58206
|
function localStorageEffect(variable, extrasSerializable, wsClient, taskContext) {
|
|
@@ -59036,26 +59116,31 @@ Inferred class string: "${iconClasses}."`
|
|
|
59036
59116
|
}).catch((err2) => {
|
|
59037
59117
|
throw new Error(`Failed to import module ${props.component.py_module}`, err2);
|
|
59038
59118
|
});
|
|
59039
|
-
}, [props.component]);
|
|
59119
|
+
}, [props.component, importers]);
|
|
59040
59120
|
return component;
|
|
59041
59121
|
}
|
|
59042
59122
|
function AuthWrapper(props) {
|
|
59043
|
-
const [token, setToken] = React.useState(() => getToken());
|
|
59044
59123
|
const { data: authComponents, isLoading } = useAuthComponents();
|
|
59045
|
-
|
|
59046
|
-
|
|
59047
|
-
|
|
59048
|
-
|
|
59049
|
-
} else {
|
|
59050
|
-
localStorage.removeItem(key);
|
|
59051
|
-
}
|
|
59052
|
-
setToken(newToken);
|
|
59124
|
+
const isMounted = React.useRef(false);
|
|
59125
|
+
if (!isMounted.current) {
|
|
59126
|
+
isMounted.current = true;
|
|
59127
|
+
store.setValue("sessionToken", getToken());
|
|
59053
59128
|
}
|
|
59129
|
+
React.useEffect(() => {
|
|
59130
|
+
return store.subscribe("sessionToken", (newToken) => {
|
|
59131
|
+
const key = getTokenKey();
|
|
59132
|
+
if (newToken) {
|
|
59133
|
+
localStorage.setItem(key, newToken);
|
|
59134
|
+
} else {
|
|
59135
|
+
localStorage.removeItem(key);
|
|
59136
|
+
}
|
|
59137
|
+
});
|
|
59138
|
+
}, []);
|
|
59054
59139
|
if (isLoading) {
|
|
59055
59140
|
return /* @__PURE__ */ React__default.default.createElement(Center, null, /* @__PURE__ */ React__default.default.createElement(DefaultFallback, null));
|
|
59056
59141
|
}
|
|
59057
59142
|
const { login, logout, ...extraRoutes } = authComponents;
|
|
59058
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
59143
|
+
return /* @__PURE__ */ React__default.default.createElement(Switch$1, null, /* @__PURE__ */ React__default.default.createElement(Route, { path: "/login" }, /* @__PURE__ */ React__default.default.createElement(DynamicAuthComponent, { component: login })), /* @__PURE__ */ React__default.default.createElement(Route, { path: "/logout" }, /* @__PURE__ */ React__default.default.createElement(DynamicAuthComponent, { component: logout })), Object.entries(extraRoutes).map(([path, component]) => /* @__PURE__ */ React__default.default.createElement(Route, { key: path, path: `/${path}` }, /* @__PURE__ */ React__default.default.createElement(DynamicAuthComponent, { component }))), /* @__PURE__ */ React__default.default.createElement(Route, { component: ErrorPage, path: "/error" }), /* @__PURE__ */ React__default.default.createElement(Route, { path: "/", render: () => /* @__PURE__ */ React__default.default.createElement(PrivateRoute, null, props.children) }));
|
|
59059
59144
|
}
|
|
59060
59145
|
const index = "";
|
|
59061
59146
|
const ErrorBoundaryContext = React.createContext(null);
|
|
@@ -85913,7 +85998,6 @@ Inferred class string: "${iconClasses}."`
|
|
|
85913
85998
|
const [username, setUsername] = React.useState("");
|
|
85914
85999
|
const [password, setPassword] = React.useState("");
|
|
85915
86000
|
const [isError2, setIsError] = React.useState(false);
|
|
85916
|
-
const { token, setToken } = React.useContext(authCtx);
|
|
85917
86001
|
const history2 = useHistory();
|
|
85918
86002
|
const location2 = useLocation();
|
|
85919
86003
|
const queryParams = new URLSearchParams(location2.search);
|
|
@@ -85922,9 +86006,9 @@ Inferred class string: "${iconClasses}."`
|
|
|
85922
86006
|
setIsLoggingIn(true);
|
|
85923
86007
|
setIsError(false);
|
|
85924
86008
|
try {
|
|
85925
|
-
const sessionToken = await
|
|
86009
|
+
const sessionToken = await requestSessionToken({ password, username });
|
|
85926
86010
|
if (sessionToken) {
|
|
85927
|
-
|
|
86011
|
+
setSessionToken(sessionToken);
|
|
85928
86012
|
history2.replace(decodeURIComponent(previousLocation));
|
|
85929
86013
|
}
|
|
85930
86014
|
} catch {
|
|
@@ -85933,9 +86017,8 @@ Inferred class string: "${iconClasses}."`
|
|
|
85933
86017
|
setIsLoggingIn(false);
|
|
85934
86018
|
};
|
|
85935
86019
|
React.useEffect(() => {
|
|
85936
|
-
|
|
85937
|
-
|
|
85938
|
-
verifySessionToken(localStorage.getItem(key)).then((verified) => {
|
|
86020
|
+
if (getSessionToken()) {
|
|
86021
|
+
verifySessionToken().then((verified) => {
|
|
85939
86022
|
if (verified) {
|
|
85940
86023
|
history2.replace(decodeURIComponent(previousLocation));
|
|
85941
86024
|
} else {
|
|
@@ -85993,10 +86076,9 @@ Inferred class string: "${iconClasses}."`
|
|
|
85993
86076
|
))));
|
|
85994
86077
|
}
|
|
85995
86078
|
function BasicAuthLogout() {
|
|
85996
|
-
const { setToken, token } = useAuthCtx();
|
|
85997
86079
|
React.useEffect(() => {
|
|
85998
|
-
revokeSession(
|
|
85999
|
-
|
|
86080
|
+
revokeSession().then(() => {
|
|
86081
|
+
setSessionToken(null);
|
|
86000
86082
|
window.location.href = `${window.dara.base_url}/login`;
|
|
86001
86083
|
});
|
|
86002
86084
|
}, []);
|
|
@@ -86004,26 +86086,20 @@ Inferred class string: "${iconClasses}."`
|
|
|
86004
86086
|
}
|
|
86005
86087
|
function DefaultAuthLogin() {
|
|
86006
86088
|
var _a;
|
|
86007
|
-
const { token, setToken } = React.useContext(authCtx);
|
|
86008
86089
|
const history2 = useHistory();
|
|
86009
86090
|
const location2 = useLocation();
|
|
86010
86091
|
const queryParams = new URLSearchParams(location2.search);
|
|
86011
86092
|
const previousLocation = (_a = queryParams.get("referrer")) != null ? _a : "/";
|
|
86012
86093
|
async function getNewToken() {
|
|
86013
|
-
const sessionToken = await
|
|
86094
|
+
const sessionToken = await requestSessionToken({});
|
|
86014
86095
|
if (sessionToken) {
|
|
86015
|
-
|
|
86096
|
+
setSessionToken(sessionToken);
|
|
86016
86097
|
history2.replace(decodeURIComponent(previousLocation));
|
|
86017
86098
|
}
|
|
86018
86099
|
}
|
|
86019
86100
|
React.useEffect(() => {
|
|
86020
|
-
|
|
86021
|
-
|
|
86022
|
-
const storedToken = localStorage.getItem(key);
|
|
86023
|
-
if (token !== void 0 && token !== null && (!storedToken || storedToken === "undefined")) {
|
|
86024
|
-
localStorage.setItem(key, token);
|
|
86025
|
-
}
|
|
86026
|
-
verifySessionToken(localStorage.getItem(key)).then((verified) => {
|
|
86101
|
+
if (getSessionToken()) {
|
|
86102
|
+
verifySessionToken().then((verified) => {
|
|
86027
86103
|
if (verified) {
|
|
86028
86104
|
history2.replace(decodeURIComponent(previousLocation));
|
|
86029
86105
|
} else {
|
|
@@ -86391,7 +86467,6 @@ Inferred class string: "${iconClasses}."`
|
|
|
86391
86467
|
exports.useAction = useAction;
|
|
86392
86468
|
exports.useActionIsLoading = useActionIsLoading;
|
|
86393
86469
|
exports.useAnyVariable = useAnyVariable;
|
|
86394
|
-
exports.useAuthCtx = useAuthCtx;
|
|
86395
86470
|
exports.useComponentStyles = useComponentStyles;
|
|
86396
86471
|
exports.useDataVariable = useDataVariable;
|
|
86397
86472
|
exports.useEventBus = useEventBus;
|