Skip to content

Commit

Permalink
chore: do nothing if doc no change
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs committed Aug 15, 2024
1 parent 0605576 commit aded9a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const defaultUndoManager = createUndoManager(defaultYDoc);
const undoManagerAtom = atom<Y.UndoManager>(defaultUndoManager);

const yDocAtom = atom(defaultYDoc, (get, set, newDoc: Y.Doc) => {
if (newDoc === get(yDocAtom)) return;
get(undoManagerAtom).destroy();
const undoManager = createUndoManager(newDoc);
set(undoManagerAtom, undoManager);
Expand Down

0 comments on commit aded9a6

Please sign in to comment.