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