Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(spreadsheet): error due to duplicate unit IDs
Elian Doran7f0aa0697aa0
diff --git a/apps/client/src/widgets/type_widgets/Spreadsheet.tsx b/apps/client/src/widgets/type_widgets/Spreadsheet.tsxindex 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 | undefinedconst 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 {