feat(collections/list): filter archived notes

This commit is contained in:
Elian Doran 2025-11-13 10:21:45 +02:00
parent b13c0fe7a2
commit e51daad5da
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -255,6 +255,15 @@ export default class FNote {
return this.children; 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) { async getSubtreeNoteIds(includeArchived = false) {
let noteIds: (string | string[])[] = []; let noteIds: (string | string[])[] = [];
for (const child of await this.getChildNotes()) { for (const child of await this.getChildNotes()) {

View File

@ -141,7 +141,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
async function getNoteIds(note: FNote) { async function getNoteIds(note: FNote) {
if (viewType === "list" || viewType === "grid" || viewType === "table" || note.type === "search") { if (viewType === "list" || viewType === "grid" || viewType === "table" || note.type === "search") {
return note.getChildNoteIds(); return await note.getChildNoteIdsWithArchiveFiltering(includeArchived);
} else { } else {
return await note.getSubtreeNoteIds(includeArchived); return await note.getSubtreeNoteIds(includeArchived);
} }