-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
<script>
let count = $state(0);
let useless= $state(0)
let max = $derived(count >= 4);
$effect(() => {
$inspect.trace('Outer Effect');
count;
useless;
$effect(() => {
$inspect.trace('Inner Effect');
max ;
});
});
</script>
<button onclick={()=>{count++;}}>Count: {count}</button>
<button onclick={()=>{useless++;}}>useless: {useless}</button>https://svelte.dev/playground/9a47c3c8356a4b6faa78451e495dd72d?version=5.38.3
You can see output in the console , inspect.trac in Inner effect work bad.
Inner effect rerun brcause we change count tracked by outter effect, but in console , you can see the derived in inner effect became blue
Reproduction
https://svelte.dev/playground/9a47c3c8356a4b6faa78451e495dd72d?version=5.38.3
Logs
System Info
svelte playground with latest versionSeverity
annoyance
Metadata
Metadata
Assignees
Labels
No labels