From 4be3f0a3200ff72103663aef9cd6902ec6a102ed Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 21 Aug 2024 09:55:30 +0100 Subject: [PATCH] Fix issue where we were saving the entire datasource definition into every datasource setting --- .../DataSourceSelect/DataSourceCategory.svelte | 2 +- packages/builder/src/helpers/data/format.js | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte index fa6f477ed9..f6d7cfc2c3 100644 --- a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte +++ b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte @@ -29,7 +29,7 @@ on:click={() => onSelect(data)} > - {data.datasource?.name ? `${data.datasource.name} - ` : ""}{data.label} + {data.datasourceName ? `${data.datasourceName} - ` : ""}{data.label} ({ - label: table.name, - tableId: table._id, - type: "table", - datasource: datasources.find( - datasource => datasource._id === table.sourceId || table.datasourceId - ), - }), + table: (table, datasources) => { + const sourceId = table.sourceId || table.datasourceId + const datasource = datasources.find(ds => ds._id === sourceId) + return { + label: table.name, + tableId: table._id, + type: "table", + datasourceName: datasource?.name, + } + }, viewV2: view => ({ ...view, label: view.name,