Skip to content

Commit 0568634

Browse files
committed
fix: add try/finally block in withoutSaving method to ensure state restoration
1 parent 8b2414a commit 0568634

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/slate-history/src/history-editor.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ export const HistoryEditor = {
120120
withoutSaving(editor: HistoryEditor, fn: () => void): void {
121121
const prev = HistoryEditor.isSaving(editor)
122122
SAVING.set(editor, false)
123-
fn()
124-
SAVING.set(editor, prev)
123+
try {
124+
fn()
125+
} finally {
126+
SAVING.set(editor, prev)
127+
}
125128
},
126129
}

0 commit comments

Comments
 (0)