Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
on mounted check
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanst committed Jun 17, 2020
1 parent 016b84c commit c39f192
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Transition.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { onMount } from 'svelte';
import { onMount, tick } from 'svelte';
export let toggle = undefined;
export let transitions = '';
Expand All @@ -14,6 +14,7 @@
let slot;
let slotClasses;
let parent;
let mounted;
const STATE = {
IDLE: 0,
Expand All @@ -23,7 +24,11 @@
let state = STATE.IDLE;
onMount(() => {
onMount(async () => {
mounted = true;
await tick();
slot = div.nextElementSibling;
slotClasses = slot.classList.value;
Expand Down Expand Up @@ -143,4 +148,7 @@
bind:this={div}
hidden
/>
<slot />

{#if mounted}
<slot />
{/if}

0 comments on commit c39f192

Please sign in to comment.