sveltejs / svelte · Issue No. 18773
An out-only deferred transition crashes when an {#if} branch is removed and
then restored from an $effect during the same update.
<script>
import { crossfade } from 'svelte/transition';
let visible = $state(true);
let restore = $state(false);
const [send] = crossfade({});
$effect(() => {
if (restore) visible = true;
});
</script>
<button
onclick={() => {
visible = false;
restore = true;
}}
>
Reproduce
</button>
{#if visible}
<p out:send={{ key: 'item' }}>Deferred outro</p>
{/if}
Deferred out transition reset crash #1
Deferred out transition reset crash #2
Svelte throws:
TypeError: Cannot read properties of undefined (reading 'reset')
The stack contains:
The outro should be aborted and the branch should remain visible without a
runtime exception.
The transition function intentionally returns another function, making it a
deferred transition. Restoring the branch from $effect happens before the
deferred transition facade initializes its internal animation.
The assignment inside $effect is intentional and is required to reproduce
the runtime race.
^5.57.0
annoyance
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.