Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
core/collections/board: hide subtree by default
Adorian Doranacf5475ed58c
diff --git a/packages/trilium-core/src/services/hidden_subtree_templates.spec.ts b/packages/trilium-core/src/services/hidden_subtree_templates.spec.tsindex 3200e2245b..d4091b9ef0 100644--- a/packages/trilium-core/src/services/hidden_subtree_templates.spec.ts+++ b/packages/trilium-core/src/services/hidden_subtree_templates.spec.ts@@ -136,11 +136,11 @@ describe("buildHiddenSubtreeTemplates", () => {}});- it("applies the shared hidden-subtree label on the templates that hide their subtree", () => {+ it("applies the hidden-subtree label on the templates that declare it", () => {const templates = buildHiddenSubtreeTemplates();- const hidingIds = ["_template_calendar", "_template_table", "_template_geo_map", "_template_board"];+ const offByDefault = ["_template_calendar", "_template_table", "_template_geo_map"];- for (const id of hidingIds) {+ for (const id of offByDefault) {const item = childById(templates, id);const attr = item.attributes?.find((a) => a.name === "subtreeHidden");expect(attr, id).toBeDefined();@@ -148,6 +148,12 @@ describe("buildHiddenSubtreeTemplates", () => {expect(attr?.value, id).toBe("false");}+ // The board hides its subtree by default: the cards already list the children.+ const board = childById(templates, "_template_board");+ const boardAttr = board.attributes?.find((a) => a.name === "subtreeHidden");+ expect(boardAttr?.type).toBe("label");+ expect(boardAttr?.value ?? "").toBe("");+// The list/grid views intentionally do NOT hide their subtree.for (const id of ["_template_list_view", "_template_grid_view"]) {const item = childById(templates, id);diff --git a/packages/trilium-core/src/services/hidden_subtree_templates.ts b/packages/trilium-core/src/services/hidden_subtree_templates.tsindex 264d8684e4..5f7c910b5a 100644--- a/packages/trilium-core/src/services/hidden_subtree_templates.ts+++ b/packages/trilium-core/src/services/hidden_subtree_templates.ts@@ -265,7 +265,11 @@ export default function buildHiddenSubtreeTemplates() {name: "hidePromotedAttributes",type: "label"},- hideSubtreeAttributes+ {+ // A board shows its children as cards, so the tree would repeat them.+ name: "subtreeHidden",+ type: "label"+ }// Deliberately no `label:status`: the columns a board shows are the options of a// select definition, and a definition here would be shared by every board in the// document — one board's columns would be everyone's. Each board owns its own