atom.io 0.10.2 → 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 +56 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -33
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.js +239 -113
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +239 -113
- 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 +20 -7
- 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 +5 -5
- package/internal/src/set-state/evict-downstream.ts +10 -13
- package/internal/src/set-state/set-atom.ts +1 -1
- package/internal/src/set-state/stow-update.ts +9 -3
- 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 +7 -2
- package/internal/src/transaction/apply-transaction.ts +21 -7
- 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 +2 -2
- package/realtime-client/dist/index.js +24 -5
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/dist/index.mjs +24 -5
- package/realtime-client/dist/index.mjs.map +1 -1
- package/realtime-client/src/use-server-action.ts +24 -5
- package/src/logger.ts +82 -14
- package/src/subscribe.ts +22 -7
package/src/subscribe.ts
CHANGED
|
@@ -32,7 +32,7 @@ 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
|
|
|
@@ -40,13 +40,19 @@ export function subscribe<T>(
|
|
|
40
40
|
dependencyUnsubFunctions === null
|
|
41
41
|
? () => {
|
|
42
42
|
store.logger.info(
|
|
43
|
-
|
|
43
|
+
`🙈`,
|
|
44
|
+
state.type,
|
|
45
|
+
state.key,
|
|
46
|
+
`Removing subscription "${key}"`,
|
|
44
47
|
)
|
|
45
48
|
unsubFunction()
|
|
46
49
|
}
|
|
47
50
|
: () => {
|
|
48
51
|
store.logger.info(
|
|
49
|
-
|
|
52
|
+
`🙈`,
|
|
53
|
+
state.type,
|
|
54
|
+
state.key,
|
|
55
|
+
`Removing subscription "${key}"`,
|
|
50
56
|
)
|
|
51
57
|
unsubFunction()
|
|
52
58
|
for (const unsubFromDependency of dependencyUnsubFunctions) {
|
|
@@ -74,12 +80,18 @@ export const subscribeToTransaction = <ƒ extends ƒn>(
|
|
|
74
80
|
)
|
|
75
81
|
}
|
|
76
82
|
store.logger.info(
|
|
77
|
-
|
|
83
|
+
`👀`,
|
|
84
|
+
`transaction`,
|
|
85
|
+
token.key,
|
|
86
|
+
`Adding subscription "${key}"`,
|
|
78
87
|
)
|
|
79
88
|
const unsubscribe = tx.subject.subscribe(key, handleUpdate)
|
|
80
89
|
return () => {
|
|
81
90
|
store.logger.info(
|
|
82
|
-
|
|
91
|
+
`🙈`,
|
|
92
|
+
`transaction`,
|
|
93
|
+
token.key,
|
|
94
|
+
`Removing subscription "${key}"`,
|
|
83
95
|
)
|
|
84
96
|
unsubscribe()
|
|
85
97
|
}
|
|
@@ -97,11 +109,14 @@ export const subscribeToTimeline = (
|
|
|
97
109
|
`Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`,
|
|
98
110
|
)
|
|
99
111
|
}
|
|
100
|
-
store.logger.info(
|
|
112
|
+
store.logger.info(`👀`, `timeline`, token.key, `Adding subscription "${key}"`)
|
|
101
113
|
const unsubscribe = tl.subject.subscribe(key, handleUpdate)
|
|
102
114
|
return () => {
|
|
103
115
|
store.logger.info(
|
|
104
|
-
|
|
116
|
+
`🙈`,
|
|
117
|
+
`timeline`,
|
|
118
|
+
token.key,
|
|
119
|
+
`Removing subscription "${key}" from timeline`,
|
|
105
120
|
)
|
|
106
121
|
unsubscribe()
|
|
107
122
|
}
|