Skip to content

Commit

Permalink
assign undoManager.restore to avoid leaking EditorView
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiralucas committed Oct 24, 2024
1 parent 7d08c3c commit 24037f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/web/src/components/v2Editor/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ function Title(props: Props) {
// manually destroy collaboration undo manager
try {
// @ts-ignore
editor?.state['y-undo$']?.undoManager?.destroy()
const undoManager = editor?.state['y-undo$']?.undoManager
if (undoManager) {
undoManager.destroy()
undoManager.restore = null
}
} catch (e) {
console.error('Failed to destroy collaboration undo manager', e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ const useBlockEditor = ({
// manually destroy collaboration undo manager
try {
// @ts-ignore
editor?.state['y-undo$']?.undoManager?.destroy()
const undoManager = editor?.state['y-undo$']?.undoManager
if (undoManager) {
undoManager.destroy()
undoManager.restore = null
}
} catch (e) {
console.error('Failed to destroy collaboration undo manager', e)
}
Expand Down

0 comments on commit 24037f8

Please sign in to comment.