From f6acfc2795d24f1566b1aa8e23cb972ee41d46d1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 12 Dec 2023 15:11:04 +0000 Subject: [PATCH] Making sure relationships are valid before displaying them. --- .../_components/panels/Relationships.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Relationships.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Relationships.svelte index 519ead046f..19f2486298 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Relationships.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Relationships.svelte @@ -44,14 +44,16 @@ }) }) - return Object.values(relatedColumns).map(({ from, to, through }) => { - return { - tables: `${from.tableName} ${through ? "↔" : "→"} ${to.tableName}`, - columns: `${from.name} to ${to.name}`, - from, - to, - } - }) + return Object.values(relatedColumns) + .filter(({ from, to }) => from && to) + .map(({ from, to, through }) => { + return { + tables: `${from.tableName} ${through ? "↔" : "→"} ${to.tableName}`, + columns: `${from.name} to ${to.name}`, + from, + to, + } + }) } const handleRowClick = ({ detail }) => {