refactor(views): prepare for supporting subtrees

This commit is contained in:
Elian Doran 2025-07-14 12:53:11 +03:00
parent ec7dacfc9b
commit b29c3eff6e
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -256,6 +256,14 @@ class FNote {
return this.children; return this.children;
} }
async getSubtreeNoteIds() {
let noteIds: (string | string[])[] = [];
for (const child of await this.getChildNotes()) {
noteIds.push(await child.getSubtreeNoteIds());
}
return noteIds.flat();
}
async getChildNotes() { async getChildNotes() {
return await this.froca.getNotes(this.children); return await this.froca.getNotes(this.children);
} }

View File

@ -263,7 +263,7 @@ export default class TableView extends ViewMode<StateInfo> {
this.#manageColumnUpdate(); this.#manageColumnUpdate();
} }
if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId) if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId || this.args.noteIds.includes(branch.parentNoteId ?? ""))
|| loadResults.getNoteIds().some(noteId => this.args.noteIds.includes(noteId) || loadResults.getNoteIds().some(noteId => this.args.noteIds.includes(noteId)
|| loadResults.getAttributeRows().some(attr => this.args.noteIds.includes(attr.noteId!)))) { || loadResults.getAttributeRows().some(attr => this.args.noteIds.includes(attr.noteId!)))) {
this.#manageRowsUpdate(); this.#manageRowsUpdate();