diff --git a/apps/client/src/widgets/type_widgets/Spreadsheet.tsx b/apps/client/src/widgets/type_widgets/Spreadsheet.tsx index 8965c6c94d..d8e6b93ed2 100644 --- a/apps/client/src/widgets/type_widgets/Spreadsheet.tsx +++ b/apps/client/src/widgets/type_widgets/Spreadsheet.tsx @@ -82,6 +82,12 @@ function usePersistence(note: FNote, noteContext: NoteContext | null | undefined const univerAPI = apiRef.current; if (!univerAPI) return undefined; + // Dispose the existing workbook. + const existingNotebook = univerAPI.getActiveWorkbook(); + if (existingNotebook) { + univerAPI.disposeUnit(existingNotebook.getId()); + } + let workbook: Partial = {}; if (newContent) { try {