Fix merge issue and clear unsaved datasource changes on query load

This commit is contained in:
Rory Powell 2021-12-14 10:44:14 +00:00
parent 17ba5d7c88
commit 26abf39b76
1 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,7 @@
if (id) { if (id) {
// find the matching config on the datasource // find the matching config on the datasource
const matchedConfig = datasource?.config?.authConfigs?.filter( const matchedConfig = datasource?.config?.authConfigs?.filter(
c => c._id === authConfigId c => c._id === id
)[0] )[0]
// clear the id if the config is not found (deleted) // clear the id if the config is not found (deleted)
// i.e. just show 'None' in the dropdown // i.e. just show 'None' in the dropdown
@ -161,8 +161,10 @@
return id return id
} }
onMount(() => { onMount(async () => {
query = getSelectedQuery() query = getSelectedQuery()
// clear any unsaved changes to the datasource
await datasources.init()
datasource = $datasources.list.find(ds => ds._id === query?.datasourceId) datasource = $datasources.list.find(ds => ds._id === query?.datasourceId)
const datasourceUrl = datasource?.config.url const datasourceUrl = datasource?.config.url
const qs = query?.fields.queryString const qs = query?.fields.queryString