atom.io 0.10.1 → 0.10.3
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.mts +53 -8
- package/dist/index.d.ts +53 -8
- package/dist/index.js +64 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -33
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.js +251 -110
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +251 -110
- package/internal/dist/index.mjs.map +1 -1
- package/internal/src/atom/create-atom.ts +15 -4
- package/internal/src/atom/delete-atom.ts +1 -1
- package/internal/src/caching.ts +4 -4
- package/internal/src/get-state-internal.ts +3 -5
- package/internal/src/mutable/create-mutable-atom.ts +4 -10
- package/internal/src/operation.ts +23 -4
- package/internal/src/selector/create-read-write-selector.ts +12 -2
- package/internal/src/selector/create-readonly-selector.ts +7 -1
- package/internal/src/selector/create-selector.ts +4 -5
- package/internal/src/selector/register-selector.ts +7 -1
- package/internal/src/selector/update-selector-atoms.ts +10 -3
- package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
- package/internal/src/set-state/copy-mutable-in-transaction.ts +0 -3
- package/internal/src/set-state/emit-update.ts +6 -3
- package/internal/src/set-state/evict-downstream.ts +15 -14
- package/internal/src/set-state/set-atom.ts +1 -1
- package/internal/src/set-state/stow-update.ts +9 -4
- package/internal/src/store/store.ts +8 -19
- package/internal/src/store/withdraw-new-family-member.ts +4 -1
- package/internal/src/store/withdraw.ts +6 -1
- package/internal/src/subscribe/recall-state.ts +4 -1
- package/internal/src/subscribe/subscribe-to-root-atoms.ts +11 -5
- package/internal/src/timeline/add-atom-to-timeline.ts +40 -9
- package/internal/src/timeline/time-travel-internal.ts +26 -8
- package/internal/src/timeline/timeline-internal.ts +8 -2
- package/internal/src/transaction/abort-transaction.ts +10 -2
- package/internal/src/transaction/apply-transaction.ts +22 -5
- package/internal/src/transaction/build-transaction.ts +5 -1
- package/internal/src/transaction/redo-transaction.ts +1 -1
- package/internal/src/transaction/transaction-internal.ts +1 -4
- package/internal/src/transaction/undo-transaction.ts +7 -1
- package/package.json +3 -3
- package/realtime-client/dist/index.js +30 -5
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/dist/index.mjs +30 -5
- package/realtime-client/dist/index.mjs.map +1 -1
- package/realtime-client/src/use-server-action.ts +30 -5
- package/src/logger.ts +82 -14
- package/src/subscribe.ts +30 -7
package/src/subscribe.ts
CHANGED
|
@@ -32,19 +32,27 @@ export function subscribe<T>(
|
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
const unsubFunction = state.subject.subscribe(key, handleUpdate)
|
|
35
|
-
store.logger.info(
|
|
35
|
+
store.logger.info(`👀`, state.type, state.key, `Adding subscription "${key}"`)
|
|
36
36
|
const dependencyUnsubFunctions =
|
|
37
37
|
state.type !== `atom` ? subscribeToRootAtoms(state, store) : null
|
|
38
38
|
|
|
39
39
|
const unsubscribe =
|
|
40
40
|
dependencyUnsubFunctions === null
|
|
41
41
|
? () => {
|
|
42
|
-
store.logger.info(
|
|
42
|
+
store.logger.info(
|
|
43
|
+
`🙈`,
|
|
44
|
+
state.type,
|
|
45
|
+
state.key,
|
|
46
|
+
`Removing subscription "${key}"`,
|
|
47
|
+
)
|
|
43
48
|
unsubFunction()
|
|
44
49
|
}
|
|
45
50
|
: () => {
|
|
46
51
|
store.logger.info(
|
|
47
|
-
|
|
52
|
+
`🙈`,
|
|
53
|
+
state.type,
|
|
54
|
+
state.key,
|
|
55
|
+
`Removing subscription "${key}"`,
|
|
48
56
|
)
|
|
49
57
|
unsubFunction()
|
|
50
58
|
for (const unsubFromDependency of dependencyUnsubFunctions) {
|
|
@@ -71,10 +79,20 @@ export const subscribeToTransaction = <ƒ extends ƒn>(
|
|
|
71
79
|
`Cannot subscribe to transaction "${token.key}": transaction not found in store "${store.config.name}".`,
|
|
72
80
|
)
|
|
73
81
|
}
|
|
74
|
-
store.logger.info(
|
|
82
|
+
store.logger.info(
|
|
83
|
+
`👀`,
|
|
84
|
+
`transaction`,
|
|
85
|
+
token.key,
|
|
86
|
+
`Adding subscription "${key}"`,
|
|
87
|
+
)
|
|
75
88
|
const unsubscribe = tx.subject.subscribe(key, handleUpdate)
|
|
76
89
|
return () => {
|
|
77
|
-
store.logger.info(
|
|
90
|
+
store.logger.info(
|
|
91
|
+
`🙈`,
|
|
92
|
+
`transaction`,
|
|
93
|
+
token.key,
|
|
94
|
+
`Removing subscription "${key}"`,
|
|
95
|
+
)
|
|
78
96
|
unsubscribe()
|
|
79
97
|
}
|
|
80
98
|
}
|
|
@@ -91,10 +109,15 @@ export const subscribeToTimeline = (
|
|
|
91
109
|
`Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`,
|
|
92
110
|
)
|
|
93
111
|
}
|
|
94
|
-
store.logger.info(
|
|
112
|
+
store.logger.info(`👀`, `timeline`, token.key, `Adding subscription "${key}"`)
|
|
95
113
|
const unsubscribe = tl.subject.subscribe(key, handleUpdate)
|
|
96
114
|
return () => {
|
|
97
|
-
store.logger.info(
|
|
115
|
+
store.logger.info(
|
|
116
|
+
`🙈`,
|
|
117
|
+
`timeline`,
|
|
118
|
+
token.key,
|
|
119
|
+
`Removing subscription "${key}" from timeline`,
|
|
120
|
+
)
|
|
98
121
|
unsubscribe()
|
|
99
122
|
}
|
|
100
123
|
}
|