Skip to content

state changes in onoutrostart are not working #16349

@timephy

Description

@timephy

Describe the bug

Title says it all, here is an example:

<!-- Parent -->
<script>
	import Component from "./Component.svelte"

	let visible = $state(true)
</script>

<input type="checkbox" bind:checked={visible} />

{#if visible}
	<Component />
{/if}
<!-- Child Component -->
<script lang="ts">
	import { fly } from "svelte/transition"
	
	let status = $state("idle")
	$inspect(status)
</script>

<p transition:fly={{ y: 20, duration: 300 }} onoutrostart={() => (status = 'outro')}>status: {status}</p>

What happens

  • status is updated by the onoutrostart listener
  • $inspect(status) runs and prints that status = 'outro'
  • status: {status} is NOT updated ❌

What I expect to happen

status: {status} should be updated


I guess elements that are transitioning out are removed from receiving state updates. However this should only happen when the outro/transition ends, not when it starts.

Reproduction

https://svelte.dev/playground/a221ea9296a1411da4d3fb3563aeb183?version=latest

Logs

System Info

playground

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions