Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix crash on creating a topic

Abdullah Atta90a3bd3307aa
diff --git a/apps/web/src/common/dialog-controller.tsx b/apps/web/src/common/dialog-controller.tsx
index 9269ad5f3..ea2909958 100644
--- a/apps/web/src/common/dialog-controller.tsx
+++ b/apps/web/src/common/dialog-controller.tsx
@@ -471,9 +471,9 @@ export function showCreateTopicDialog() {
}}
onAction={async (topic: Record<string, unknown>) => {
if (!topic) return;
- const notebookId = notebookStore.get().selectedNotebookId;
- await db.notebooks?.notebook(notebookId).topics.add(topic);
- notebookStore.setSelectedNotebook(notebookId);
+ const notebook = notebookStore.get().selectedNotebook;
+ await db.notebooks?.notebook(notebook.id).topics.add(topic);
+ notebookStore.setSelectedNotebook(notebook.id);
showToast("success", "Topic created!");
perform(true);
}}