From 26abf39b76146dc338c9516ee93f2fcea342929a Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 14 Dec 2021 10:44:14 +0000 Subject: [PATCH] Fix merge issue and clear unsaved datasource changes on query load --- .../[selectedDatasource]/rest/[query]/index.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte index 706e6b5f42..7a743b13b8 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte @@ -150,7 +150,7 @@ if (id) { // find the matching config on the datasource const matchedConfig = datasource?.config?.authConfigs?.filter( - c => c._id === authConfigId + c => c._id === id )[0] // clear the id if the config is not found (deleted) // i.e. just show 'None' in the dropdown @@ -161,8 +161,10 @@ return id } - onMount(() => { + onMount(async () => { query = getSelectedQuery() + // clear any unsaved changes to the datasource + await datasources.init() datasource = $datasources.list.find(ds => ds._id === query?.datasourceId) const datasourceUrl = datasource?.config.url const qs = query?.fields.queryString