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
chore(react/collections/table): react to nesting depth change
Elian Doran0c7f9264217e
diff --git a/apps/client/src/widgets/collections/table/index.tsx b/apps/client/src/widgets/collections/table/index.tsxindex 72dfeeb912..4b60a4abd6 100644--- a/apps/client/src/widgets/collections/table/index.tsx+++ b/apps/client/src/widgets/collections/table/index.tsx@@ -134,7 +134,7 @@ function useData(note: FNote, noteIds: string[], viewConfig: TableConfig | undef});}- useEffect(refresh, [ note, noteIds ]);+ useEffect(refresh, [ note, noteIds, maxDepth ]);// React to column changes.useTriliumEvent("entitiesReloaded", ({ loadResults}) => {diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.tsindex 479e6f90b6..f25430f852 100644--- a/apps/client/src/widgets/view_widgets/table_view/index.ts+++ b/apps/client/src/widgets/view_widgets/table_view/index.ts@@ -3,7 +3,6 @@ import attributes from "../../../services/attributes.js";import SpacedUpdate from "../../../services/spaced_update.js";import type { EventData } from "../../../components/app_context.js";-import { canReorderRows, configureReorderingRows } from "./dragging.js";import buildFooter from "./footer.js";import getAttributeDefinitionInformation, { buildRowDefinitions } from "./rows.js";import { AttributeDefinitionInformation, buildColumnDefinitions } from "./columns.js";@@ -49,14 +48,6 @@ export default class TableView extends ViewMode<StateInfo> {return this.$root;}- private async renderTable(el: HTMLElement) {- for (const module of modules) {- Tabulator.registerModule(module);- }-- this.initialize(el, info);- }-private async initialize(el: HTMLElement, info: AttributeDefinitionInformation[]) {const viewStorage = await this.viewStorage.restore();this.persistentData = viewStorage?.tableData || {};@@ -66,9 +57,6 @@ export default class TableView extends ViewMode<StateInfo> {this.colEditing = new TableColumnEditing(this.args.$parent, this.args.parentNote, this.api);this.rowEditing = new TableRowEditing(this.api, this.args.parentNotePath!);- if (movableRows) {- configureReorderingRows(this.api);- }setupContextMenu(this.api, this.parentNote);}@@ -82,21 +70,6 @@ export default class TableView extends ViewMode<StateInfo> {return true;}- // Refresh if promoted attributes get changed.- if (loadResults.getAttributeRows().find(attr =>- attr.type === "label" &&- (attr.name?.startsWith("label:") || attr.name?.startsWith("relation:")) &&- attributes.isAffecting(attr, this.parentNote))) {- this.#manageColumnUpdate();- //return await this.#manageRowsUpdate();- }-- // Refresh max depth- if (loadResults.getAttributeRows().find(attr => attr.type === "label" && attr.name === "maxNestingDepth" && attributes.isAffecting(attr, this.parentNote))) {- this.maxDepth = parseInt(this.parentNote.getLabelValue("maxNestingDepth") ?? "-1", 10);- return await this.#manageRowsUpdate();- }-if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId || this.noteIds.includes(branch.parentNoteId ?? ""))|| loadResults.getNoteIds().some(noteId => this.noteIds.includes(noteId))|| loadResults.getAttributeRows().some(attr => this.noteIds.includes(attr.noteId!))) {