Skip to content

Build your personal knowledge base with Trilium Notes

refactor(views): prepare for supporting subtrees

Elian Doranb29c3eff6e75
diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.ts
index b5d575ed97..15ba79c229 100644
--- a/apps/client/src/entities/fnote.ts
+++ b/apps/client/src/entities/fnote.ts
@@ -256,6 +256,14 @@ class FNote {
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() {
return await this.froca.getNotes(this.children);
}
diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.ts
index 40d431ad06..023af3e422 100644
--- a/apps/client/src/widgets/view_widgets/table_view/index.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/index.ts
@@ -263,7 +263,7 @@ export default class TableView extends ViewMode<StateInfo> {
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.getAttributeRows().some(attr => this.args.noteIds.includes(attr.noteId!)))) {
this.#manageRowsUpdate();