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) {
609
609
var tracking = ( current_async_effect . f & REACTION_IS_UPDATING ) !== 0 ;
610
610
var was_read = current_async_effect . deps ?. includes ( signal ) ;
611
611
612
- if ( ! tracking && ! was_read ) {
612
+ if ( ! tracking && ! untracking && ! was_read ) {
613
613
w . await_reactivity_loss ( /** @type {string } */ ( signal . label ) ) ;
614
614
615
615
var trace = get_stack ( 'TracedAt' ) ;
Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ export default test({
6
6
dev : true
7
7
} ,
8
8
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>` ,
10
10
11
11
async test ( { assert, target, warnings } ) {
12
12
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
+ ) ;
14
17
15
18
assert . equal (
16
19
warnings [ 0 ] ,
Original file line number Diff line number Diff line change 1
1
<script >
2
+ import { untrack } from ' svelte' ;
2
3
let a = $state (1 );
3
4
let b = $state (2 );
5
+ let c = $state (3 );
4
6
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) ;
7
9
}
8
10
</script >
9
11
10
12
<button onclick ={() => a ++ }>a</button >
11
13
<button onclick ={() => b ++ }>b</button >
14
+ <button onclick ={() => c ++ }>c</button >
12
15
13
16
<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 >
16
19
17
20
{#snippet pending ()}
18
21
<p >pending</p >
You can’t perform that action at this time.
0 commit comments