Move datasource init to onMount
This commit is contained in:
parent
9581c1d381
commit
451116b690
|
@ -21,6 +21,7 @@
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
|
|
||||||
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
|
import ImportRestQueriesModal from "components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte"
|
||||||
|
import { onMount } from "svelte"
|
||||||
let importQueriesModal
|
let importQueriesModal
|
||||||
|
|
||||||
let changed
|
let changed
|
||||||
|
@ -34,14 +35,6 @@
|
||||||
ds => ds._id === $datasources.selected
|
ds => ds._id === $datasources.selected
|
||||||
)
|
)
|
||||||
$: integration = datasource && $integrations[datasource.source]
|
$: integration = datasource && $integrations[datasource.source]
|
||||||
$: {
|
|
||||||
if (
|
|
||||||
baseDatasource &&
|
|
||||||
(!datasource || datasource.source !== baseDatasource.source)
|
|
||||||
) {
|
|
||||||
datasource = cloneDeep(baseDatasource)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$: queryList = $queries.list.filter(
|
$: queryList = $queries.list.filter(
|
||||||
query => query.datasourceId === datasource?._id
|
query => query.datasourceId === datasource?._id
|
||||||
)
|
)
|
||||||
|
@ -72,6 +65,10 @@
|
||||||
queries.select(query)
|
queries.select(query)
|
||||||
$goto(`./${query._id}`)
|
$goto(`./${query._id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
datasource = cloneDeep(baseDatasource)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal bind:this={importQueriesModal}>
|
<Modal bind:this={importQueriesModal}>
|
||||||
|
|
Loading…
Reference in New Issue