fix(spreadsheet): error due to duplicate unit IDs

This commit is contained in:
Elian Doran
2026-03-03 19:20:25 +02:00
parent d123ce33b8
commit 7f0aa0697a

View File

@@ -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<IWorkbookData> = {};
if (newContent) {
try {