Skip to content

Commit

Permalink
fix: #37 added transact to shared type updated to prevent double update
Browse files Browse the repository at this point in the history
  • Loading branch information
joebobmiles committed Nov 3, 2022
1 parent 82d2f24 commit b2572c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const yjs = <S extends State>(
(partial, replace) =>
{
set(partial, replace);
patchSharedType(map, get());
doc.transact(() =>
patchSharedType(map, get()));
},
get,
{
Expand All @@ -62,7 +63,8 @@ const yjs = <S extends State>(
"setState": (partial, replace) =>
{
api.setState(partial, replace);
patchSharedType(map, api.getState());
doc.transact(() =>
patchSharedType(map, api.getState()));
},
}
);
Expand Down

0 comments on commit b2572c7

Please sign in to comment.