Skip to content

Build your personal knowledge base with Trilium Notes

feat(views/table): refresh on attribute change

Elian Doran44ce6a5169db
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 7ec559a85c..45fe41d458 100644
--- a/apps/client/src/widgets/view_widgets/table_view/index.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/index.ts
@@ -8,7 +8,7 @@ import server from "../../../services/server.js";
import type { GridApi, GridState } from "ag-grid-community";
import SpacedUpdate from "../../../services/spaced_update.js";
import branches from "../../../services/branches.js";
-import type { CommandListenerData } from "../../../components/app_context.js";
+import type { CommandListenerData, EventData } from "../../../components/app_context.js";
import type { Attribute } from "../../../services/attribute_parser.js";
const TPL = /*html*/`
@@ -184,5 +184,17 @@ export default class TableView extends ViewMode<StateInfo> {
console.log("Save attributes", this.newAttribute);
}
+ onEntitiesReloaded({ loadResults }: EventData<"entitiesReloaded">): boolean | void {
+ // Refresh if promoted attributes get changed.
+ if (loadResults.getAttributeRows().find(attr =>
+ attr.type === "label" &&
+ attr.name?.startsWith("label:") &&
+ attributes.isAffecting(attr, this.parentNote))) {
+ return true;
+ }
+
+ return false;
+ }
+
}