Skip to content

fix: don't log await_reactivity_loss warning when signal is read in untrack #16385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-readers-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: don't log `await_reactivity_loss` warning when signal is read in `untrack`
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export function get(signal) {
var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
var was_read = current_async_effect.deps?.includes(signal);

if (!tracking && !was_read) {
if (!tracking && !untracking && !was_read) {
w.await_reactivity_loss(/** @type {string} */ (signal.label));

var trace = get_stack('TracedAt');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ export default test({
dev: true
},

html: `<button>a</button><button>b</button><p>pending</p>`,
html: `<button>a</button><button>b</button><button>c</button><p>pending</p>`,

async test({ assert, target, warnings }) {
await tick();
assert.htmlEqual(target.innerHTML, '<button>a</button><button>b</button><h1>3</h1><p>3</p>');
assert.htmlEqual(
target.innerHTML,
'<button>a</button><button>b</button><button>c</button><h1>6</h1><p>6</p>'
);

assert.equal(
warnings[0],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<script>
import { untrack } from 'svelte';
let a = $state(1);
let b = $state(2);
let c = $state(3);

async function a_plus_b() {
return await a + await b;
async function a_plus_b_plus_c() {
return await a + await b + await untrack(() => c);
}
</script>

<button onclick={() => a++}>a</button>
<button onclick={() => b++}>b</button>
<button onclick={() => c++}>c</button>

<svelte:boundary>
<h1>{await a_plus_b()}</h1>
<p>{await a + await b}</p>
<h1>{await a_plus_b_plus_c()}</h1>
<p>{await a + await b + await c}</p>

{#snippet pending()}
<p>pending</p>
Expand Down
Loading