Skip to content

Commit e51daad

Browse files
committed
feat(collections/list): filter archived notes
1 parent b13c0fe commit e51daad

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

apps/client/src/entities/fnote.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ export default class FNote {
255255
return this.children;
256256
}
257257

258+
async getChildNoteIdsWithArchiveFiltering(includeArchived = false) {
259+
let noteIds: string[] = [];
260+
for (const child of await this.getChildNotes()) {
261+
if (child.isArchived && !includeArchived) continue;
262+
noteIds.push(child.noteId);
263+
}
264+
return noteIds;
265+
}
266+
258267
async getSubtreeNoteIds(includeArchived = false) {
259268
let noteIds: (string | string[])[] = [];
260269
for (const child of await this.getChildNotes()) {

apps/client/src/widgets/collections/NoteList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
141141

142142
async function getNoteIds(note: FNote) {
143143
if (viewType === "list" || viewType === "grid" || viewType === "table" || note.type === "search") {
144-
return note.getChildNoteIds();
144+
return await note.getChildNoteIdsWithArchiveFiltering(includeArchived);
145145
} else {
146146
return await note.getSubtreeNoteIds(includeArchived);
147147
}

0 commit comments

Comments
 (0)