Skip to content

Commit ca94175

Browse files
authored
fix: initialize subAtom state on mount with current store state (#56)
1 parent 1d379bb commit ca94175

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/jotai/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function loroMirrorAtom<S extends SchemaType>(
8989
});
9090

9191
subAtom.onMount = (set) => {
92+
set(store.getState() as InferType<S>);
9293
const sub = store.subscribe((state, { direction }) => {
9394
if (direction === SyncDirection.FROM_LORO) {
9495
set(state);

0 commit comments

Comments
 (0)