From 71c470f59d40769669ef8330ff682ca6accebe5e Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 4 Sep 2021 14:26:29 +0100 Subject: [PATCH] Desktop: Fixes #5417: Handle invalid search index in Goto Anything --- packages/app-desktop/plugins/GotoAnything.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/app-desktop/plugins/GotoAnything.tsx b/packages/app-desktop/plugins/GotoAnything.tsx index ebcc84ab8..f27b2877b 100644 --- a/packages/app-desktop/plugins/GotoAnything.tsx +++ b/packages/app-desktop/plugins/GotoAnything.tsx @@ -337,6 +337,10 @@ class Dialog extends React.PureComponent { // @ts-ignore const notesById = notes.reduce((obj, { id, body, markup_language }) => ((obj[[id]] = { id, body, markup_language }), obj), {}); + // Filter out search results that are associated with non-existing notes. + // https://github.com/laurent22/joplin/issues/5417 + results = results.filter(r => !!notesById[r.id]); + for (let i = 0; i < results.length; i++) { const row = results[i]; const path = Folder.folderPathString(this.props.folders, row.parent_id);