Flip datasource and baseDatsource to not update store directly

This commit is contained in:
Rory Powell 2021-12-14 11:34:12 +00:00
parent 26abf39b76
commit 7337ae6f67
1 changed files with 9 additions and 6 deletions

View File

@ -23,20 +23,23 @@
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
let importQueriesModal
let baseDatasource, changed
let changed
const querySchema = {
name: {},
queryVerb: { displayName: "Method" },
}
$: datasource = $datasources.list.find(ds => ds._id === $datasources.selected)
$: baseDatasource = $datasources.list.find(
ds => ds._id === $datasources.selected
)
$: datasource = cloneDeep(datasource)
$: integration = datasource && $integrations[datasource.source]
$: {
if (
datasource &&
(!baseDatasource || baseDatasource.source !== datasource.source)
baseDatasource &&
(!datasource || datasource.source !== baseDatasource.source)
) {
baseDatasource = cloneDeep(datasource)
datasource = cloneDeep(baseDatasource)
}
}
$: queryList = $queries.list.filter(
@ -90,7 +93,7 @@
height="26"
width="26"
/>
<Heading size="M">{baseDatasource.name}</Heading>
<Heading size="M">{datasource.name}</Heading>
</header>
<Body size="M">{integration.description}</Body>
</Layout>