-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
Description
Describe the bug
As you can see , when i change count1 , async function (even without proimse )called in markup with await run before effect.pre
Reproduction
<script>
import { tick } from 'svelte';
// 定义多个状态变量
let count1 = $state(0);
$effect.pre(() => {
count1 ;
console.log('Effect pre')});
$effect(() => {
count1 ;
console.log('Effect')
return ()=>{console.log('tear down'); }
});
//zero run before effect pre
async function zero(num) {
console.log(`zero begin`);
return 0;
}
function one(num) {
console.log(`one begin`);
return 1;
}
</script>
<p>count 1: {count1}</p>
<button onclick={()=>{count1+=1 } }>count1++</button>
<div>
<p>zero : {await zero(count1)}</p>
</div>
<div>
<p>one : {one(count1)}</p>
</div>
Logs
zero begin
Effect pre
one begin
tear down
Effect
System Info
playground
Severity
annoyance