From 997daf17d0897050ef87c24fbc78831ba45e9247 Mon Sep 17 00:00:00 2001 From: andz-bb Date: Mon, 9 Dec 2024 10:29:37 +0000 Subject: [PATCH] handle cases where datasourceName is undefined when sorting datasources --- .../controls/DataSourceSelect/DataSourceSelect.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte index 9eef8c1c06..e79ed75d76 100644 --- a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte @@ -56,7 +56,10 @@ .map(table => format.table(table, $datasources.list)) .sort((a, b) => { // sort tables alphabetically, grouped by datasource - const dsComparison = a.datasourceName.localeCompare(b.datasourceName) + const dsA = a.datasourceName ?? "" + const dsB = b.datasourceName ?? "" + + const dsComparison = dsA.localeCompare(dsB) if (dsComparison !== 0) { return dsComparison }