Skip to content

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

fix: Cannot read property 'topics' of undefined

thecodrr7930fdb5ddfb
diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.js
index 1a8524762..71f6a54ba 100644
--- a/apps/web/src/common/index.js
+++ b/apps/web/src/common/index.js
@@ -63,8 +63,10 @@ export function notesFromContext(context) {
notes = db.notes.colored(context.value);
break;
case "topic":
- const notebook = db.notebooks.notebook(context.value.id);
- const topic = notebook.topics.topic(context.value.topic);
+ const notebook = db.notebooks.notebook(context?.value?.id);
+ if (!notebook) break;
+ const topic = notebook.topics?.topic(context?.value?.topic);
+ if (!topic) break;
notes = topic.all;
break;
case "favorite":