From e51daad5da676c3708ef00f250592eb97e4693a4 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 13 Nov 2025 10:21:45 +0200 Subject: [PATCH] feat(collections/list): filter archived notes --- apps/client/src/entities/fnote.ts | 9 +++++++++ apps/client/src/widgets/collections/NoteList.tsx | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.ts index e59ac671d..5b4857acc 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.tsx index c39b4e7e8..421f45cc4 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: ViewTypeOpt async 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); }