fix bug when switching between tabs

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-20 16:57:38 +02:00
parent 8175fdd7a0
commit 8ca3624e24
1 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<script>
import { onMount } from "svelte"
import { onMount, tick } from "svelte"
import {
Button,
Detail,
@ -44,6 +44,16 @@
onMount(() => {
mounted = true
})
async function fixMountBug({ detail }) {
console.log(detail)
if (detail === "Edit") {
await tick()
mounted = true
} else {
mounted = false
}
}
</script>
<Page wide>
@ -69,7 +79,7 @@
menu on the right.</Body
>
</Layout>
<Tabs selected="Edit">
<Tabs selected="Edit" on:select={fixMountBug}>
<Tab title="Edit">
<div class="template-editor">
<Editor