Open daveychu opened 2 years ago
@daveychu a workaround, use the $navigating
store to stop the animation and detach the node
<script>
import { navigating } from "$app/stores";
</script>
{#if !$navigating && $store.show}
<p transition:fly={{ y: 100, duration: 2000 }}>Peekaboo!</p>
{/if}
@daveychu I think You can try local transitions as well. These used to work back in Sapper times.
{#if $store.show}
<p transition:fly|local={{ y: 100, duration: 2000 }}>Peekaboo!</p>
{/if}
I believe this is a Svelte core issue, and I vaguely remember having commented on a similar issue about a minimum reproducible independent of SvelteKit, but I can't find it right now
We hit this in multiple routes now. Did not tried to reproduce it in a sample repo (I should/will try when got a bit of time) but I noticed two following things:
Above workaround, {#if $navigating}....
, work for us too.
I ran into this issue when breaking out of layout groups with global transitions. Open popovers and sometimes entire pages would stick around and stack after navigating to routes in another group.
A silly workaround I found for it was to add a group: 'groupName'
prop in the corresponding (groupName)/+layout.ts
load function and wrap the entire (groupName)/+layout.svelte
content in {#if $page.data.group === 'groupName'}...{/if}
.
This seems to force the "clean-up" of the initial layout when navigating to a route in another layout group.
Describe the bug
onDestroy
not called if the template has a transition based on astore
variable that gets assigned to after callinggoto
.In our real scenario it was caused by a programming error, but the cause was hard to track down because of multiple layers of derivations. Not sure if there's ever a valid reason for this situation, but confusing if you make the same mistake.
Reproduction
npm run dev -- --open
Expected: Only shows page 2 Actual: Shows both pages (or more if you keep going) and a transition on page 1
Logs
No response
System Info
Severity
annoyance
Additional Information
No response