atom.io 0.9.4 → 0.9.6

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.
@@ -908,6 +908,9 @@ var cacheValue = (key, value, subject, store = IMPLICIT.STORE) => {
908
908
  const future = new Future(value);
909
909
  target(store).valueMap.set(key, future);
910
910
  future.then((value2) => {
911
+ if (future.isCanceled) {
912
+ return;
913
+ }
911
914
  cacheValue(key, value2, subject, store);
912
915
  subject.next({ newValue: value2, oldValue: value2 });
913
916
  }).catch((error) => {
@@ -923,6 +926,16 @@ var cacheValue = (key, value, subject, store = IMPLICIT.STORE) => {
923
926
  };
924
927
  var readCachedValue = (key, store = IMPLICIT.STORE) => target(store).valueMap.get(key);
925
928
  var isValueCached = (key, store = IMPLICIT.STORE) => target(store).valueMap.has(key);
929
+ var evictCachedValue = (key, store = IMPLICIT.STORE) => {
930
+ var _a;
931
+ const core = target(store);
932
+ const currentValue = core.valueMap.get(key);
933
+ if (currentValue instanceof Future) {
934
+ currentValue.cancel();
935
+ }
936
+ core.valueMap.delete(key);
937
+ (_a = store.config.logger) == null ? void 0 : _a.info(` xx evicted "${key}"`);
938
+ };
926
939
  var Tracker = class {
927
940
  constructor(mutableState, store = IMPLICIT.STORE) {
928
941
  this.unsubscribeFromInnerValue = null;
@@ -1252,7 +1265,7 @@ var emitUpdate = (state, update, store) => {
1252
1265
 
1253
1266
  // src/set-state/evict-downstream.ts
1254
1267
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1255
- var _a, _b, _c, _d, _e, _f, _g;
1268
+ var _a, _b, _c, _d, _e, _f;
1256
1269
  const core = target(store);
1257
1270
  const downstreamKeys = core.selectorAtoms.getRelatedKeys(state.key);
1258
1271
  (_b = store.config.logger) == null ? void 0 : _b.info(
@@ -1275,8 +1288,7 @@ var evictDownStream = (state, store = IMPLICIT.STORE) => {
1275
1288
  );
1276
1289
  return;
1277
1290
  }
1278
- core.valueMap.delete(key);
1279
- (_g = store.config.logger) == null ? void 0 : _g.info(` xx evicted "${key}"`);
1291
+ evictCachedValue(key, store);
1280
1292
  markDone(key, store);
1281
1293
  }
1282
1294
  }
@@ -1822,6 +1834,6 @@ var subscribeToRootAtoms = (state, store) => {
1822
1834
  return dependencySubscriptions;
1823
1835
  };
1824
1836
 
1825
- export { FamilyTracker, Future, IMPLICIT, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
1837
+ export { FamilyTracker, Future, IMPLICIT, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
1826
1838
  //# sourceMappingURL=out.js.map
1827
1839
  //# sourceMappingURL=index.mjs.map