atom.io 0.19.1 → 0.19.2
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/data/dist/index.cjs +99 -79
- package/data/dist/index.js +2 -2
- package/data/src/join.ts +67 -50
- package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
- package/dist/{chunk-7VCCW45K.js → chunk-CC7IF7QF.js} +4 -3
- package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
- package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
- package/dist/index.cjs +14 -7
- package/dist/index.d.ts +23 -35
- package/dist/index.js +14 -7
- package/internal/dist/index.cjs +55 -43
- package/internal/dist/index.d.ts +20 -20
- package/internal/dist/index.js +48 -36
- package/internal/src/atom/create-regular-atom.ts +7 -5
- package/internal/src/atom/delete-atom.ts +2 -2
- package/internal/src/families/create-readonly-selector-family.ts +2 -2
- package/internal/src/families/create-regular-atom-family.ts +1 -1
- package/internal/src/families/create-writable-selector-family.ts +1 -1
- package/internal/src/future.ts +4 -2
- package/internal/src/lineage.ts +1 -0
- package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
- package/internal/src/mutable/create-mutable-atom.ts +7 -5
- package/internal/src/mutable/tracker.ts +3 -3
- package/internal/src/mutable/transceiver.ts +2 -2
- package/internal/src/selector/delete-selector.ts +1 -1
- package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
- package/internal/src/store/deposit.ts +5 -5
- package/internal/src/store/store.ts +5 -5
- package/internal/src/store/withdraw.ts +4 -5
- package/internal/src/subject.ts +3 -1
- package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
- package/internal/src/timeline/add-atom-to-timeline.ts +13 -8
- package/internal/src/timeline/create-timeline.ts +3 -4
- package/internal/src/transaction/act-upon-store.ts +5 -5
- package/internal/src/transaction/apply-transaction.ts +4 -4
- package/internal/src/transaction/build-transaction.ts +9 -6
- package/internal/src/transaction/create-transaction.ts +10 -10
- package/internal/src/transaction/index.ts +3 -3
- package/internal/src/transaction/is-root-store.ts +2 -2
- package/introspection/dist/index.d.ts +3 -3
- package/introspection/src/attach-introspection-states.ts +3 -3
- package/introspection/src/attach-transaction-index.ts +4 -4
- package/introspection/src/attach-transaction-logs.ts +8 -4
- package/json/dist/index.cjs +6 -2
- package/json/dist/index.js +6 -2
- package/json/src/select-json-family.ts +3 -2
- package/json/src/select-json.ts +3 -1
- package/package.json +243 -241
- package/react/dist/index.cjs +9 -3
- package/react/dist/index.js +9 -3
- package/react/src/use-i.ts +3 -1
- package/react/src/use-tl.ts +6 -2
- package/react-devtools/dist/index.cjs +116 -53
- package/react-devtools/dist/index.d.ts +3 -5
- package/react-devtools/dist/index.js +113 -51
- package/react-devtools/src/AtomIODevtools.tsx +3 -1
- package/react-devtools/src/Button.tsx +3 -1
- package/react-devtools/src/StateIndex.tsx +6 -2
- package/react-devtools/src/TimelineIndex.tsx +6 -2
- package/react-devtools/src/TransactionIndex.tsx +3 -3
- package/react-devtools/src/Updates.tsx +14 -6
- package/realtime/dist/index.cjs +1 -0
- package/realtime/dist/index.d.ts +2 -2
- package/realtime/dist/index.js +1 -0
- package/realtime/src/realtime-continuity.ts +4 -3
- package/realtime-client/dist/index.cjs +29 -29
- package/realtime-client/dist/index.d.ts +2 -2
- package/realtime-client/dist/index.js +1 -1
- package/realtime-client/src/server-action.ts +2 -2
- package/realtime-client/src/sync-continuity.ts +23 -23
- package/realtime-react/dist/index.cjs +29 -29
- package/realtime-react/dist/index.d.ts +2 -2
- package/realtime-react/dist/index.js +1 -1
- package/realtime-react/src/use-server-action.ts +3 -3
- package/realtime-server/dist/index.cjs +54 -44
- package/realtime-server/dist/index.d.ts +5 -5
- package/realtime-server/dist/index.js +34 -24
- package/realtime-server/src/ipc-sockets/child-socket.ts +6 -6
- package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
- package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
- package/realtime-server/src/realtime-action-receiver.ts +7 -5
- package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
- package/realtime-server/src/realtime-state-receiver.ts +3 -1
- package/realtime-testing/dist/index.cjs +15 -13
- package/realtime-testing/dist/index.js +9 -7
- package/realtime-testing/src/setup-realtime-test.tsx +6 -4
- package/src/atom.ts +4 -8
- package/src/dispose.ts +1 -0
- package/src/index.ts +2 -9
- package/src/selector.ts +4 -8
- package/src/silo.ts +9 -3
- package/src/subscribe.ts +6 -6
- package/src/timeline.ts +4 -4
- package/src/transaction.ts +24 -24
- package/transceivers/set-rtx/dist/index.cjs +11 -12
- package/transceivers/set-rtx/dist/index.js +11 -12
- package/transceivers/set-rtx/src/set-rtx.ts +10 -10
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
AtomFamily,
|
|
3
2
|
AtomFamilyToken,
|
|
4
3
|
FamilyMetadata,
|
|
5
4
|
StateUpdate,
|
|
@@ -9,7 +8,7 @@ import type {
|
|
|
9
8
|
TimelineUpdate,
|
|
10
9
|
TokenType,
|
|
11
10
|
TransactionUpdate,
|
|
12
|
-
|
|
11
|
+
Func,
|
|
13
12
|
} from "atom.io"
|
|
14
13
|
|
|
15
14
|
import { newest } from "../lineage"
|
|
@@ -31,7 +30,7 @@ export type TimelineSelectorUpdate<ManagedAtom extends TimelineManageable> = {
|
|
|
31
30
|
timestamp: number
|
|
32
31
|
atomUpdates: Omit<TimelineAtomUpdate<ManagedAtom>, `timestamp`>[]
|
|
33
32
|
}
|
|
34
|
-
export type TimelineTransactionUpdate = TransactionUpdate
|
|
33
|
+
export type TimelineTransactionUpdate = TransactionUpdate<Func> & {
|
|
35
34
|
key: string
|
|
36
35
|
type: `transaction_update`
|
|
37
36
|
timestamp: number
|
|
@@ -73,7 +72,7 @@ export function createTimeline<ManagedAtom extends TimelineManageable>(
|
|
|
73
72
|
transactionKey: null,
|
|
74
73
|
...data,
|
|
75
74
|
history: data?.history.map((update) => ({ ...update })) ?? [],
|
|
76
|
-
install: (
|
|
75
|
+
install: (s) => createTimeline(options, s, tl),
|
|
77
76
|
subject: new Subject(),
|
|
78
77
|
}
|
|
79
78
|
if (options.shouldCapture) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { TransactionToken,
|
|
1
|
+
import type { TransactionToken, Func } from "atom.io"
|
|
2
2
|
|
|
3
3
|
import { NotFoundError } from "../not-found-error"
|
|
4
4
|
import type { Store } from "../store"
|
|
5
5
|
import { withdraw } from "../store"
|
|
6
6
|
|
|
7
|
-
export function actUponStore
|
|
8
|
-
token: TransactionToken
|
|
7
|
+
export function actUponStore<F extends Func>(
|
|
8
|
+
token: TransactionToken<F>,
|
|
9
9
|
id: string,
|
|
10
10
|
store: Store,
|
|
11
|
-
): (...parameters: Parameters
|
|
12
|
-
return (...parameters: Parameters
|
|
11
|
+
): (...parameters: Parameters<F>) => ReturnType<F> {
|
|
12
|
+
return (...parameters: Parameters<F>): ReturnType<F> => {
|
|
13
13
|
const tx = withdraw(token, store)
|
|
14
14
|
if (tx) {
|
|
15
15
|
return tx.run(parameters, id)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Func } from "atom.io"
|
|
2
2
|
|
|
3
3
|
import { ingestTransactionUpdate } from "../ingest-updates"
|
|
4
4
|
import { newest } from "../lineage"
|
|
@@ -7,8 +7,8 @@ import type { Store } from "../store"
|
|
|
7
7
|
import { isChildStore, isRootStore } from "./is-root-store"
|
|
8
8
|
import { setEpochNumberOfAction } from "./set-epoch-number"
|
|
9
9
|
|
|
10
|
-
export const applyTransaction =
|
|
11
|
-
output: ReturnType
|
|
10
|
+
export const applyTransaction = <F extends Func>(
|
|
11
|
+
output: ReturnType<F>,
|
|
12
12
|
store: Store,
|
|
13
13
|
): void => {
|
|
14
14
|
const child = newest(store)
|
|
@@ -65,7 +65,7 @@ export const applyTransaction = <ƒ extends ƒn>(
|
|
|
65
65
|
child.transactionMeta.update.epoch,
|
|
66
66
|
parent,
|
|
67
67
|
)
|
|
68
|
-
const myTransaction = withdraw
|
|
68
|
+
const myTransaction = withdraw<F>(
|
|
69
69
|
{ key: child.transactionMeta.update.key, type: `transaction` },
|
|
70
70
|
store,
|
|
71
71
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { findState,
|
|
1
|
+
import type { findState, Func } from "atom.io"
|
|
2
2
|
|
|
3
3
|
import { Junction } from "~/packages/rel8/junction/src"
|
|
4
4
|
|
|
@@ -45,8 +45,8 @@ export const buildTransaction = (
|
|
|
45
45
|
valueMap: new LazyMap(parent.valueMap),
|
|
46
46
|
}
|
|
47
47
|
const epoch = getEpochNumberOfAction(key, store)
|
|
48
|
-
const transactionMeta: TransactionProgress
|
|
49
|
-
phase: `building
|
|
48
|
+
const transactionMeta: TransactionProgress<Func> = {
|
|
49
|
+
phase: `building`,
|
|
50
50
|
update: {
|
|
51
51
|
key,
|
|
52
52
|
id,
|
|
@@ -57,9 +57,12 @@ export const buildTransaction = (
|
|
|
57
57
|
},
|
|
58
58
|
transactors: {
|
|
59
59
|
get: (token) => getFromStore(token, child),
|
|
60
|
-
set: (token, value) =>
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
set: (token, value) => {
|
|
61
|
+
setIntoStore(token, value, child)
|
|
62
|
+
},
|
|
63
|
+
run: (token, identifier = arbitrary()) =>
|
|
64
|
+
actUponStore(token, identifier, child),
|
|
65
|
+
find: ((token, k) => findInStore(token, k, child)) as typeof findState,
|
|
63
66
|
env: () => getEnvironmentData(child),
|
|
64
67
|
},
|
|
65
68
|
}
|
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
TransactionOptions,
|
|
3
3
|
TransactionToken,
|
|
4
4
|
TransactionUpdate,
|
|
5
|
-
|
|
5
|
+
Func,
|
|
6
6
|
} from "atom.io"
|
|
7
7
|
|
|
8
8
|
import { newest } from "../lineage"
|
|
@@ -13,22 +13,22 @@ import { abortTransaction } from "./abort-transaction"
|
|
|
13
13
|
import { applyTransaction } from "./apply-transaction"
|
|
14
14
|
import { buildTransaction } from "./build-transaction"
|
|
15
15
|
|
|
16
|
-
export type Transaction
|
|
16
|
+
export type Transaction<F extends Func> = {
|
|
17
17
|
key: string
|
|
18
18
|
type: `transaction`
|
|
19
19
|
install: (store: Store) => void
|
|
20
|
-
subject: Subject<TransactionUpdate
|
|
21
|
-
run: (parameters: Parameters
|
|
20
|
+
subject: Subject<TransactionUpdate<F>>
|
|
21
|
+
run: (parameters: Parameters<F>, id?: string) => ReturnType<F>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function createTransaction
|
|
25
|
-
options: TransactionOptions
|
|
24
|
+
export function createTransaction<F extends Func>(
|
|
25
|
+
options: TransactionOptions<F>,
|
|
26
26
|
store: Store,
|
|
27
|
-
): TransactionToken
|
|
28
|
-
const newTransaction: Transaction
|
|
27
|
+
): TransactionToken<F> {
|
|
28
|
+
const newTransaction: Transaction<F> = {
|
|
29
29
|
key: options.key,
|
|
30
30
|
type: `transaction`,
|
|
31
|
-
run: (params: Parameters
|
|
31
|
+
run: (params: Parameters<F>, id: string) => {
|
|
32
32
|
const childStore = buildTransaction(options.key, params, store, id)
|
|
33
33
|
try {
|
|
34
34
|
const target = newest(store)
|
|
@@ -42,7 +42,7 @@ export function createTransaction<ƒ extends ƒn>(
|
|
|
42
42
|
throw thrown
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
install: (
|
|
45
|
+
install: (s) => createTransaction(options, s),
|
|
46
46
|
subject: new Subject(),
|
|
47
47
|
}
|
|
48
48
|
const target = newest(store)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TransactionUpdate, TransactorsWithRunAndEnv,
|
|
1
|
+
import type { TransactionUpdate, TransactorsWithRunAndEnv, Func } from "atom.io"
|
|
2
2
|
import type { Junction } from "rel8/junction"
|
|
3
3
|
|
|
4
4
|
export * from "./abort-transaction"
|
|
@@ -14,9 +14,9 @@ export * from "./set-epoch-number"
|
|
|
14
14
|
export const TRANSACTION_PHASES = [`idle`, `building`, `applying`] as const
|
|
15
15
|
export type TransactionPhase = (typeof TRANSACTION_PHASES)[number]
|
|
16
16
|
|
|
17
|
-
export type TransactionProgress
|
|
17
|
+
export type TransactionProgress<F extends Func> = {
|
|
18
18
|
phase: `applying` | `building`
|
|
19
|
-
update: TransactionUpdate
|
|
19
|
+
update: TransactionUpdate<F>
|
|
20
20
|
transactors: TransactorsWithRunAndEnv
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Func } from "atom.io"
|
|
2
2
|
|
|
3
3
|
import type { TransactionEpoch, TransactionProgress } from "."
|
|
4
4
|
import type { Store } from "../store"
|
|
@@ -9,7 +9,7 @@ export interface RootStore extends Store {
|
|
|
9
9
|
child: ChildStore | null
|
|
10
10
|
}
|
|
11
11
|
export interface ChildStore extends Store {
|
|
12
|
-
transactionMeta: TransactionProgress
|
|
12
|
+
transactionMeta: TransactionProgress<Func>
|
|
13
13
|
parent: ChildStore | RootStore
|
|
14
14
|
child: ChildStore | null
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AtomToken, ReadonlySelectorToken, WritableSelectorToken, TransactionToken,
|
|
1
|
+
import { AtomToken, ReadonlySelectorToken, WritableSelectorToken, TransactionToken, Func, ReadonlySelectorFamilyToken, TransactionUpdate, TimelineToken } from 'atom.io';
|
|
2
2
|
import * as Internal from 'atom.io/internal';
|
|
3
3
|
import { Timeline } from 'atom.io/internal';
|
|
4
4
|
|
|
@@ -9,8 +9,8 @@ type SelectorTokenIndex = WritableTokenIndex<ReadonlySelectorToken<unknown> | Wr
|
|
|
9
9
|
declare const attachIntrospectionStates: (store?: Internal.Store) => {
|
|
10
10
|
atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
11
11
|
selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
12
|
-
transactionIndex: ReadonlySelectorToken<TransactionToken<
|
|
13
|
-
findTransactionLogState: ReadonlySelectorFamilyToken<TransactionUpdate<
|
|
12
|
+
transactionIndex: ReadonlySelectorToken<TransactionToken<Func>[]>;
|
|
13
|
+
findTransactionLogState: ReadonlySelectorFamilyToken<TransactionUpdate<Func>[], string>;
|
|
14
14
|
timelineIndex: ReadonlySelectorToken<TimelineToken<any>[]>;
|
|
15
15
|
findTimelineState: ReadonlySelectorFamilyToken<Timeline<any>, string>;
|
|
16
16
|
};
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
TimelineToken,
|
|
6
6
|
TransactionToken,
|
|
7
7
|
TransactionUpdate,
|
|
8
|
-
|
|
8
|
+
Func,
|
|
9
9
|
} from "atom.io"
|
|
10
10
|
import * as Internal from "atom.io/internal"
|
|
11
11
|
import type { Timeline } from "atom.io/internal"
|
|
@@ -23,9 +23,9 @@ export const attachIntrospectionStates = (
|
|
|
23
23
|
): {
|
|
24
24
|
atomIndex: ReadonlySelectorToken<AtomTokenIndex>
|
|
25
25
|
selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>
|
|
26
|
-
transactionIndex: ReadonlySelectorToken<TransactionToken
|
|
26
|
+
transactionIndex: ReadonlySelectorToken<TransactionToken<Func>[]>
|
|
27
27
|
findTransactionLogState: ReadonlySelectorFamilyToken<
|
|
28
|
-
TransactionUpdate
|
|
28
|
+
TransactionUpdate<Func>[],
|
|
29
29
|
string
|
|
30
30
|
>
|
|
31
31
|
timelineIndex: ReadonlySelectorToken<TimelineToken<any>[]>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReadonlySelectorToken, TransactionToken,
|
|
1
|
+
import type { ReadonlySelectorToken, TransactionToken, Func } from "atom.io"
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
3
|
import {
|
|
4
4
|
IMPLICIT,
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
|
|
9
9
|
export const attachTransactionIndex = (
|
|
10
10
|
store: Store = IMPLICIT.STORE,
|
|
11
|
-
): ReadonlySelectorToken<TransactionToken
|
|
11
|
+
): ReadonlySelectorToken<TransactionToken<Func>[]> => {
|
|
12
12
|
const transactionTokenIndexState__INTERNAL = createRegularAtom<
|
|
13
|
-
TransactionToken
|
|
13
|
+
TransactionToken<Func>[]
|
|
14
14
|
>(
|
|
15
15
|
{
|
|
16
16
|
key: `👁🗨 Transaction Token Index (Internal)`,
|
|
17
17
|
default: () =>
|
|
18
|
-
[...store.transactions].map(([key]): TransactionToken
|
|
18
|
+
[...store.transactions].map(([key]): TransactionToken<Func> => {
|
|
19
19
|
return { key, type: `transaction` }
|
|
20
20
|
}),
|
|
21
21
|
effects: [
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ReadonlySelectorFamilyToken,
|
|
3
|
+
TransactionUpdate,
|
|
4
|
+
Func,
|
|
5
|
+
} from "atom.io"
|
|
2
6
|
import type { Store } from "atom.io/internal"
|
|
3
7
|
import {
|
|
4
8
|
IMPLICIT,
|
|
@@ -8,9 +12,9 @@ import {
|
|
|
8
12
|
|
|
9
13
|
export const attachTransactionLogs = (
|
|
10
14
|
store: Store = IMPLICIT.STORE,
|
|
11
|
-
): ReadonlySelectorFamilyToken<TransactionUpdate
|
|
15
|
+
): ReadonlySelectorFamilyToken<TransactionUpdate<Func>[], string> => {
|
|
12
16
|
const findTransactionUpdateLog = createRegularAtomFamily<
|
|
13
|
-
TransactionUpdate
|
|
17
|
+
TransactionUpdate<Func>[],
|
|
14
18
|
string
|
|
15
19
|
>(
|
|
16
20
|
{
|
|
@@ -30,7 +34,7 @@ export const attachTransactionLogs = (
|
|
|
30
34
|
store,
|
|
31
35
|
)
|
|
32
36
|
const findTransactionUpdateLogState = createSelectorFamily<
|
|
33
|
-
TransactionUpdate
|
|
37
|
+
TransactionUpdate<Func>[],
|
|
34
38
|
string
|
|
35
39
|
>(
|
|
36
40
|
{
|
package/json/dist/index.cjs
CHANGED
|
@@ -49,7 +49,9 @@ var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
|
|
|
49
49
|
{
|
|
50
50
|
key: `${atom.key}:JSON`,
|
|
51
51
|
get: ({ get }) => transform.toJson(get(atom)),
|
|
52
|
-
set: ({ set }, newValue) =>
|
|
52
|
+
set: ({ set }, newValue) => {
|
|
53
|
+
set(atom, transform.fromJson(newValue));
|
|
54
|
+
}
|
|
53
55
|
},
|
|
54
56
|
store
|
|
55
57
|
);
|
|
@@ -59,7 +61,9 @@ function selectJsonFamily(atomFamily, transform, store = internal.IMPLICIT.STORE
|
|
|
59
61
|
{
|
|
60
62
|
key: `${atomFamily.key}:JSON`,
|
|
61
63
|
get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
|
|
62
|
-
set: (key) => ({ set }, newValue) =>
|
|
64
|
+
set: (key) => ({ set }, newValue) => {
|
|
65
|
+
set(atomFamily(key), transform.fromJson(newValue));
|
|
66
|
+
}
|
|
63
67
|
},
|
|
64
68
|
store
|
|
65
69
|
);
|
package/json/dist/index.js
CHANGED
|
@@ -8,7 +8,9 @@ var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
|
8
8
|
{
|
|
9
9
|
key: `${atom.key}:JSON`,
|
|
10
10
|
get: ({ get }) => transform.toJson(get(atom)),
|
|
11
|
-
set: ({ set }, newValue) =>
|
|
11
|
+
set: ({ set }, newValue) => {
|
|
12
|
+
set(atom, transform.fromJson(newValue));
|
|
13
|
+
}
|
|
12
14
|
},
|
|
13
15
|
store
|
|
14
16
|
);
|
|
@@ -18,7 +20,9 @@ function selectJsonFamily(atomFamily, transform, store = IMPLICIT.STORE) {
|
|
|
18
20
|
{
|
|
19
21
|
key: `${atomFamily.key}:JSON`,
|
|
20
22
|
get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
|
|
21
|
-
set: (key) => ({ set }, newValue) =>
|
|
23
|
+
set: (key) => ({ set }, newValue) => {
|
|
24
|
+
set(atomFamily(key), transform.fromJson(newValue));
|
|
25
|
+
}
|
|
22
26
|
},
|
|
23
27
|
store
|
|
24
28
|
);
|
|
@@ -43,8 +43,9 @@ export function selectJsonFamily<
|
|
|
43
43
|
transform.toJson(get(atomFamily(key))),
|
|
44
44
|
set:
|
|
45
45
|
(key) =>
|
|
46
|
-
({ set }, newValue) =>
|
|
47
|
-
set(atomFamily(key), transform.fromJson(newValue))
|
|
46
|
+
({ set }, newValue) => {
|
|
47
|
+
set(atomFamily(key), transform.fromJson(newValue))
|
|
48
|
+
},
|
|
48
49
|
},
|
|
49
50
|
store,
|
|
50
51
|
)
|
package/json/src/select-json.ts
CHANGED
|
@@ -14,7 +14,9 @@ export const selectJson = <T, J extends Json.Serializable>(
|
|
|
14
14
|
{
|
|
15
15
|
key: `${atom.key}:JSON`,
|
|
16
16
|
get: ({ get }) => transform.toJson(get(atom)),
|
|
17
|
-
set: ({ set }, newValue) =>
|
|
17
|
+
set: ({ set }, newValue) => {
|
|
18
|
+
set(atom, transform.fromJson(newValue))
|
|
19
|
+
},
|
|
18
20
|
},
|
|
19
21
|
store,
|
|
20
22
|
)
|