Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(collections/list): filter archived notes
Elian Dorane51daad5da67
diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.tsindex e59ac671d4..5b4857accb 100644--- a/apps/client/src/entities/fnote.ts+++ b/apps/client/src/entities/fnote.ts@@ -255,6 +255,15 @@ export default class FNote {return this.children;}+ async getChildNoteIdsWithArchiveFiltering(includeArchived = false) {+ let noteIds: string[] = [];+ for (const child of await this.getChildNotes()) {+ if (child.isArchived && !includeArchived) continue;+ noteIds.push(child.noteId);+ }+ return noteIds;+ }+async getSubtreeNoteIds(includeArchived = false) {let noteIds: (string | string[])[] = [];for (const child of await this.getChildNotes()) {diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsxindex c39b4e7e83..421f45cc4c 100644--- a/apps/client/src/widgets/collections/NoteList.tsx+++ b/apps/client/src/widgets/collections/NoteList.tsx@@ -141,7 +141,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOptasync function getNoteIds(note: FNote) {if (viewType === "list" || viewType === "grid" || viewType === "table" || note.type === "search") {- return note.getChildNoteIds();+ return await note.getChildNoteIdsWithArchiveFiltering(includeArchived);} else {return await note.getSubtreeNoteIds(includeArchived);}