From 3049f7b37611e0d22e71b21fc8a5f72f32320547 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 9 Nov 2023 16:05:24 +0100 Subject: [PATCH] Handle open/close --- .../DatasourceNavigator.svelte | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte index fb8ab937c6..5f914f545a 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte @@ -33,15 +33,9 @@ $queries, $views, $viewsV2, - openDataSources + openDataSources, + searchTerm ) - $: openDataSource = enrichedDataSources.find(x => x.open) - $: { - // Ensure the open datasource is always actually open - if (openDataSource) { - openNode(openDataSource) - } - } const enrichDatasources = ( datasources, @@ -51,11 +45,13 @@ queries, views, viewsV2, - openDataSources + openDataSources, + searchTerm ) => { if (!datasources?.list?.length) { return [] } + const onlySource = datasources.list.length === 1 return datasources.list.map(datasource => { const selected = isActive("./datasource") && @@ -70,12 +66,11 @@ views, viewsV2 ) - const onlySource = datasources.list.length === 1 return { ...datasource, selected, containsSelected, - open: open || onlySource, + open: open || onlySource || !!searchTerm, } }) } @@ -210,7 +205,7 @@ {/if} - {#if datasource.open || searchTerm} + {#if datasource.open} {#each $queries.list.filter(query => query.datasourceId === datasource._id && (!searchTerm || query.name ?.toLowerCase()