From a4664576fe80d35e89e3dd10be7276be00f7d2d5 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 4 Jul 2025 15:05:00 +0300 Subject: [PATCH] feat(views/table): separate data model for relations --- apps/client/src/widgets/view_widgets/table_view/data.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/view_widgets/table_view/data.ts b/apps/client/src/widgets/view_widgets/table_view/data.ts index 4dd8c7b12..37240e71c 100644 --- a/apps/client/src/widgets/view_widgets/table_view/data.ts +++ b/apps/client/src/widgets/view_widgets/table_view/data.ts @@ -9,6 +9,7 @@ export type TableData = { noteId: string; title: string; labels: Record; + relations: Record; branchId: string; position: number; }; @@ -100,8 +101,10 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[]) { ]; for (const { name, title, type } of info) { + const prefix = (type === "relation" ? "relations" : "labels"); + columnDefs.push({ - field: `labels.${name}`, + field: `${prefix}.${name}`, title: title ?? name, editor: "input", ...labelTypeMappings[type ?? "text"], @@ -135,9 +138,10 @@ export async function buildRowDefinitions(parentNote: FNote, notes: FNote[], inf } const labels: typeof definitions[0]["labels"] = {}; + const relations: typeof definitions[0]["relations"] = {}; for (const { name, type } of infos) { if (type === "relation") { - labels[name] = note.getRelationValue(name); + relations[name] = note.getRelationValue(name); } else if (type === "boolean") { labels[name] = note.hasLabel(name); } else { @@ -149,6 +153,7 @@ export async function buildRowDefinitions(parentNote: FNote, notes: FNote[], inf noteId: note.noteId, title: note.title, labels, + relations, position: branch.notePosition, branchId: branch.branchId });