web: fix crash on creating a topic

This commit is contained in:
Abdullah Atta
2023-03-23 13:12:35 +05:00
committed by Abdullah Atta
parent dd9c555bff
commit 90a3bd3307

View File

@@ -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);
}}