atom.io 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -174,6 +174,7 @@ declare const LoggerIconDictionary: {
174
174
  readonly "\u23F9\uFE0F": "Time-travel complete";
175
175
  readonly "\u2705": "Realtime transaction success";
176
176
  readonly "\u2728": "Computation complete";
177
+ readonly "\u2757": "Must wait to proceed with attempted action";
177
178
  readonly "\u274C": "Conflict prevents attempted action";
178
179
  readonly "\u2B55": "Operation start";
179
180
  readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
@@ -774,11 +774,11 @@ var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing insta
774
774
  // internal/src/operation.ts
775
775
  var openOperation = (token, store) => {
776
776
  if (store.operation.open) {
777
- store.logger.error(
778
- `\u274C`,
777
+ store.logger.warn(
778
+ `\u2757`,
779
779
  token.type,
780
780
  token.key,
781
- `failed to setState during a setState for "${store.operation.token.key}"`
781
+ `tried to setState, but must wait until setState for "${store.operation.token.key}" completes`
782
782
  );
783
783
  return `rejection`;
784
784
  }
@@ -991,6 +991,13 @@ var setAtomOrSelector = (state, value, store) => {
991
991
  function setIntoStore(token, value, store) {
992
992
  const rejection = openOperation(token, store);
993
993
  if (rejection) {
994
+ const unsubscribe = store.on.operationClose.subscribe(
995
+ `waiting to set "${token.key}"`,
996
+ () => {
997
+ unsubscribe();
998
+ setIntoStore(token, value, store);
999
+ }
1000
+ );
994
1001
  return;
995
1002
  }
996
1003
  const state = withdrawOrCreate(token, store);
@@ -496,11 +496,11 @@ var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing insta
496
496
  // internal/src/operation.ts
497
497
  var openOperation = (token, store) => {
498
498
  if (store.operation.open) {
499
- store.logger.error(
500
- `\u274C`,
499
+ store.logger.warn(
500
+ `\u2757`,
501
501
  token.type,
502
502
  token.key,
503
- `failed to setState during a setState for "${store.operation.token.key}"`
503
+ `tried to setState, but must wait until setState for "${store.operation.token.key}" completes`
504
504
  );
505
505
  return `rejection`;
506
506
  }
@@ -713,6 +713,13 @@ var setAtomOrSelector = (state, value, store) => {
713
713
  function setIntoStore(token, value, store) {
714
714
  const rejection = openOperation(token, store);
715
715
  if (rejection) {
716
+ const unsubscribe = store.on.operationClose.subscribe(
717
+ `waiting to set "${token.key}"`,
718
+ () => {
719
+ unsubscribe();
720
+ setIntoStore(token, value, store);
721
+ }
722
+ );
716
723
  return;
717
724
  }
718
725
  const state = withdrawOrCreate(token, store);
@@ -21,11 +21,11 @@ export const openOperation = (
21
21
  store: Store,
22
22
  ): `rejection` | undefined => {
23
23
  if (store.operation.open) {
24
- store.logger.error(
25
- `❌`,
24
+ store.logger.warn(
25
+ `❗`,
26
26
  token.type,
27
27
  token.key,
28
- `failed to setState during a setState for "${store.operation.token.key}"`,
28
+ `tried to setState, but must wait until setState for "${store.operation.token.key}" completes`,
29
29
  )
30
30
  return `rejection`
31
31
  }
@@ -1,6 +1,5 @@
1
1
  import type { WritableToken } from "atom.io"
2
2
 
3
- import { NotFoundError } from "../not-found-error"
4
3
  import { closeOperation, openOperation } from "../operation"
5
4
  import type { Store } from "../store"
6
5
  import { withdrawOrCreate } from "../store"
@@ -13,6 +12,13 @@ export function setIntoStore<T, New extends T>(
13
12
  ): void {
14
13
  const rejection = openOperation(token, store)
15
14
  if (rejection) {
15
+ const unsubscribe = store.on.operationClose.subscribe(
16
+ `waiting to set "${token.key}"`,
17
+ () => {
18
+ unsubscribe()
19
+ setIntoStore(token, value, store)
20
+ },
21
+ )
16
22
  return
17
23
  }
18
24
  const state = withdrawOrCreate(token, store)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -58,8 +58,8 @@
58
58
  "@types/tmp": "0.2.6",
59
59
  "@typescript-eslint/parser": "7.7.1",
60
60
  "@typescript-eslint/rule-tester": "7.7.1",
61
- "@vitest/coverage-v8": "1.5.1",
62
- "@vitest/ui": "1.5.1",
61
+ "@vitest/coverage-v8": "1.5.2",
62
+ "@vitest/ui": "1.5.2",
63
63
  "concurrently": "8.2.2",
64
64
  "drizzle-kit": "0.20.17",
65
65
  "drizzle-orm": "0.30.9",
@@ -81,7 +81,7 @@
81
81
  "typescript": "5.4.5",
82
82
  "vite": "5.2.10",
83
83
  "vite-tsconfig-paths": "4.3.2",
84
- "vitest": "1.5.1"
84
+ "vitest": "1.5.2"
85
85
  },
86
86
  "main": "dist/index.js",
87
87
  "types": "dist/index.d.ts",
package/src/logger.ts CHANGED
@@ -8,6 +8,7 @@ const LoggerIconDictionary = {
8
8
  "⏹️": `Time-travel complete`,
9
9
  "✅": `Realtime transaction success`,
10
10
  "✨": `Computation complete`,
11
+ "❗": `Must wait to proceed with attempted action`,
11
12
  "❌": `Conflict prevents attempted action`,
12
13
  "⭕": `Operation start`,
13
14
  "🐞": `Possible bug in AtomIO`,