File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed
tests/runtime-runes/samples/async-reactivity-loss Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: don't log ` await_reactivity_loss ` warning when signal is read in ` untrack `
Original file line number Diff line number Diff line change @@ -609,7 +609,7 @@ export function get(signal) {
609609 var tracking = ( current_async_effect . f & REACTION_IS_UPDATING ) !== 0 ;
610610 var was_read = current_async_effect . deps ?. includes ( signal ) ;
611611
612- if ( ! tracking && ! was_read ) {
612+ if ( ! tracking && ! untracking && ! was_read ) {
613613 w . await_reactivity_loss ( /** @type {string } */ ( signal . label ) ) ;
614614
615615 var trace = get_stack ( 'TracedAt' ) ;
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