fix recent changes showing deleted search note, closes #1331

This commit is contained in:
zadam 2020-10-26 19:58:56 +01:00
parent c671b0a345
commit 8901c3ec91
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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') {