diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsx index 1f5cd292c..84a5522bf 100644 --- a/apps/mobile/app/screens/notes/index.tsx +++ b/apps/mobile/app/screens/notes/index.tsx @@ -181,8 +181,9 @@ const NotesPage = ({ if (isNew) setLoadingNotes(true); const notes = get(params.current, true) as NoteType[]; if ( - (item.type === "tag" || item.type === "color") && - (!notes || notes.length === 0) + ((item.type === "tag" || item.type === "color") && + (!notes || notes.length === 0)) || + (item.type === "topic" && !notes) ) { return Navigation.goBack(); } diff --git a/apps/mobile/app/screens/notes/topic-notes.tsx b/apps/mobile/app/screens/notes/topic-notes.tsx index 65e427588..911b0a4f0 100644 --- a/apps/mobile/app/screens/notes/topic-notes.tsx +++ b/apps/mobile/app/screens/notes/topic-notes.tsx @@ -75,7 +75,11 @@ export const TopicNotes = ({ TopicNotes.get = (params: NotesScreenParams, grouped = true) => { const { id, notebookId } = params.item as TopicType; - const notes = db.notebooks?.notebook(notebookId)?.topics.topic(id)?.all || []; + const topic = db.notebooks?.notebook(notebookId)?.topics.topic(id); + if (!topic) { + return null; + } + const notes = topic?.all || []; return grouped ? groupArray(notes, db.settings?.getGroupOptions("notes")) : notes;