You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Svelte 5 legacy reactive $: also runs before onMount if its dependency state is updated in the child component initialization. (via default value or assignment)
I think relying on this behavior is a bad practice, but it could be a breaking change.
<script>
import { onMount } from'svelte'importComponentfrom"./Component.svelte"let foo;onMount(() => { foo =false; }) $:if (foo) {// This now runs in svelte 5console.log('reactive: ', foo); }
</script>
<Componentbind:foo />
Describe the bug
In Svelte 5 legacy reactive
$:
also runs beforeonMount
if its dependency state is updated in the child component initialization. (via default value or assignment)I think relying on this behavior is a bad practice, but it could be a breaking change.
Reproduction
Same code in Svelte 4 and Svelte 5 playgrounds:
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: