File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
packages/svelte/tests/runtime-runes/samples/async-reactivity-loss Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ export default test({
66 dev : true
77 } ,
88
9- html : `<button>a</button><button>b</button><p>pending</p>` ,
9+ html : `<button>a</button><button>b</button><button>c</button>< p>pending</p>` ,
1010
1111 async test ( { assert, target, warnings } ) {
1212 await tick ( ) ;
13- assert . htmlEqual ( target . innerHTML , '<button>a</button><button>b</button><h1>3</h1><p>3</p>' ) ;
13+ assert . htmlEqual (
14+ target . innerHTML ,
15+ '<button>a</button><button>b</button><button>c</button><h1>6</h1><p>6</p>'
16+ ) ;
1417
1518 assert . equal (
1619 warnings [ 0 ] ,
Original file line number Diff line number Diff line change 11<script >
2+ import { untrack } from ' svelte' ;
23 let a = $state (1 );
34 let b = $state (2 );
5+ let c = $state (3 );
46
5- async function a_plus_b () {
6- return await a + await b;
7+ async function a_plus_b_plus_c () {
8+ return await a + await b + await untrack (() => c) ;
79 }
810 </script >
911
1012<button onclick ={() => a ++ }>a</button >
1113<button onclick ={() => b ++ }>b</button >
14+ <button onclick ={() => c ++ }>c</button >
1215
1316<svelte:boundary >
14- <h1 >{await a_plus_b ()}</h1 >
15- <p >{await a + await b }</p >
17+ <h1 >{await a_plus_b_plus_c ()}</h1 >
18+ <p >{await a + await b + await c }</p >
1619
1720 {#snippet pending ()}
1821 <p >pending</p >
You can’t perform that action at this time.
0 commit comments