Skip to content

Build your personal knowledge base with Trilium Notes

fix recent changes showing deleted search note, closes #1331

zadam8901c3ec9154
diff --git a/src/public/app/services/tree_cache.js b/src/public/app/services/tree_cache.js
index 6db3716279..c252aebbee 100644
--- a/src/public/app/services/tree_cache.js
+++ b/src/public/app/services/tree_cache.js
@@ -191,8 +191,8 @@ class TreeCache {
if (note.type === 'search') {
const searchResultNoteIds = await server.get('search-note/' + note.noteId);
- if (!searchResultNoteIds) {
- throw new Error(`Search note ${note.noteId} failed.`);
+ if (!Array.isArray(searchResultNoteIds)) {
+ throw new Error(`Search note ${note.noteId} failed: ${searchResultNoteIds}`);
}
// force to load all the notes at once instead of one by one
diff --git a/src/routes/api/search.js b/src/routes/api/search.js
index ef81122f66..201c7bbbf7 100644
--- a/src/routes/api/search.js
+++ b/src/routes/api/search.js
@@ -38,7 +38,8 @@ async function searchFromNote(req) {
}
if (note.isDeleted) {
- return [400, `Note ${req.params.noteId} is deleted.`];
+ // this can be triggered from recent changes and it's harmless to return empty list rather than fail
+ return [];
}
if (note.type !== 'search') {