Skip to content

Build your personal knowledge base with Trilium Notes

chore(search): don't render note list if no results

Elian Doran01f6368f9540
diff --git a/apps/client/src/widgets/search_result.ts b/apps/client/src/widgets/search_result.ts
index 635ad191ed..155c3d2b69 100644
--- a/apps/client/src/widgets/search_result.ts
+++ b/apps/client/src/widgets/search_result.ts
@@ -55,10 +55,16 @@ export default class SearchResultWidget extends NoteContextAwareWidget {
}
async refreshWithNote(note: FNote) {
+ const noResults = note.getChildNoteIds().length === 0 && !!note.searchResultsLoaded;
+
this.$content.empty();
- this.$noResults.toggle(note.getChildNoteIds().length === 0 && !!note.searchResultsLoaded);
+ this.$noResults.toggle(noResults);
this.$notExecutedYet.toggle(!note.searchResultsLoaded);
+ if (noResults || !note.searchResultsLoaded) {
+ return;
+ }
+
const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds(), true);
await noteListRenderer.renderList();
}