From 0c7f9264217e4e92505a40c6115fff323927d110 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 9 Sep 2025 19:00:08 +0300 Subject: [PATCH] chore(react/collections/table): react to nesting depth change --- .../src/widgets/collections/table/index.tsx | 2 +- .../widgets/view_widgets/table_view/index.ts | 27 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/apps/client/src/widgets/collections/table/index.tsx b/apps/client/src/widgets/collections/table/index.tsx index 72dfeeb91..4b60a4abd 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.ts index 479e6f90b..f25430f85 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 { 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 { 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 { 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!))) {