1
0
Fork 0
mirror of synced 2024-06-30 12:00:31 +12:00

makes sure the frontend selects a database when navigated to

This commit is contained in:
kevmodrome 2020-04-13 12:59:46 +02:00
parent 114a629cf1
commit 52dbc7e62a

View file

@ -1 +1,22 @@
<slot />
<script>
import { store, backendUiStore } from "builderStore"
import { goto } from "@sveltech/routify"
import { onMount } from "svelte"
$: instances = $store.appInstances
$: views = $store.hierarchy.indexes
async function selectDatabase(database) {
backendUiStore.actions.records.select(null)
backendUiStore.actions.views.select(views[0])
backendUiStore.actions.database.select(database)
}
onMount(async () => {
if ($store.appInstances.length > 0 && !$backendUiStore.database) {
await selectDatabase($store.appInstances[0])
}
})
</script>
<slot />