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

Commit

Permalink
Merge pull request #1 from jvanst/fix/sapper-slot-visibilty
Browse files Browse the repository at this point in the history
fix: slot flickering when built for ssr
  • Loading branch information
drgarlic authored Jun 18, 2020
2 parents 016b84c + c39f192 commit 0da5961
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 0da5961

Please sign in to comment.