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) => { 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); }}