Skip to content

Commit 4a93f38

Browse files
fix: re-enable runtime warning for reactivity loss after await
1 parent 01cd352 commit 4a93f38

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

.changeset/smooth-comics-shine.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: correctly print `!doctype` during `print`

packages/svelte/src/internal/client/runtime.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ export function is_dirty(reaction) {
175175
for (var i = 0; i < length; i++) {
176176
var dependency = dependencies[i];
177177

178-
if (is_dirty(/** @type {Derived} */ (dependency))) {
179-
update_derived(/** @type {Derived} */ (dependency));
178+
if (is_dirty(/** @type {Derived} */(dependency))) {
179+
update_derived(/** @type {Derived} */(dependency));
180180
}
181181

182182
if (dependency.wv > reaction.wv) {
@@ -215,14 +215,14 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
215215
var reaction = reactions[i];
216216

217217
if ((reaction.f & DERIVED) !== 0) {
218-
schedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);
218+
schedule_possible_effect_self_invalidation(/** @type {Derived} */(reaction), effect, false);
219219
} else if (effect === reaction) {
220220
if (root) {
221221
set_signal_status(reaction, DIRTY);
222222
} else if ((reaction.f & CLEAN) !== 0) {
223223
set_signal_status(reaction, MAYBE_DIRTY);
224224
}
225-
schedule_effect(/** @type {Effect} */ (reaction));
225+
schedule_effect(/** @type {Effect} */(reaction));
226226
}
227227
}
228228
}
@@ -301,7 +301,7 @@ export function update_reaction(reaction) {
301301
for (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {
302302
schedule_possible_effect_self_invalidation(
303303
untracked_writes[i],
304-
/** @type {Effect} */ (reaction)
304+
/** @type {Effect} */(reaction)
305305
);
306306
}
307307
}
@@ -382,8 +382,8 @@ function remove_reaction(signal, dependency) {
382382
dependency.f &= ~WAS_MARKED;
383383
}
384384
// Disconnect any reactions owned by this reaction
385-
destroy_derived_effects(/** @type {Derived} **/ (dependency));
386-
remove_reactions(/** @type {Derived} **/ (dependency), 0);
385+
destroy_derived_effects(/** @type {Derived} **/(dependency));
386+
remove_reactions(/** @type {Derived} **/(dependency), 0);
387387
}
388388
}
389389

@@ -547,19 +547,18 @@ export function get(signal) {
547547
}
548548

549549
if (DEV) {
550-
// TODO reinstate this, but make it actually work
551-
// if (current_async_effect) {
552-
// var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
553-
// var was_read = current_async_effect.deps?.includes(signal);
550+
if (current_async_effect) {
551+
var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
552+
var was_read = current_async_effect.deps?.includes(signal);
554553

555-
// if (!tracking && !untracking && !was_read) {
556-
// w.await_reactivity_loss(/** @type {string} */ (signal.label));
554+
if (!tracking && !untracking && !was_read) {
555+
w.await_reactivity_loss(/** @type {string} */ (signal.label));
557556

558-
// var trace = get_error('traced at');
559-
// // eslint-disable-next-line no-console
560-
// if (trace) console.warn(trace);
561-
// }
562-
// }
557+
var trace = get_error('traced at');
558+
// eslint-disable-next-line no-console
559+
if (trace) console.warn(trace);
560+
}
561+
}
563562

564563
recent_async_deriveds.delete(signal);
565564

@@ -659,7 +658,7 @@ function reconnect(derived) {
659658
(dep.reactions ??= []).push(derived);
660659

661660
if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
662-
reconnect(/** @type {Derived} */ (dep));
661+
reconnect(/** @type {Derived} */(dep));
663662
}
664663
}
665664
}
@@ -674,7 +673,7 @@ function depends_on_old_values(derived) {
674673
return true;
675674
}
676675

677-
if ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {
676+
if ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */(dep))) {
678677
return true;
679678
}
680679
}

0 commit comments

Comments
 (0)