Skip to content
Open
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/smooth-comics-shine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: correctly print `!doctype` during `print`
25 changes: 12 additions & 13 deletions packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,19 +547,18 @@ export function get(signal) {
}

if (DEV) {
// TODO reinstate this, but make it actually work
// if (current_async_effect) {
// var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
// var was_read = current_async_effect.deps?.includes(signal);

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

// var trace = get_error('traced at');
// // eslint-disable-next-line no-console
// if (trace) console.warn(trace);
// }
// }
if (current_async_effect) {
var tracking = (current_async_effect.f & REACTION_IS_UPDATING) !== 0;
var was_read = current_async_effect.deps?.includes(signal);

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

var stack_trace = get_error('traced at');
// eslint-disable-next-line no-console
if (stack_trace) console.warn(stack_trace);
}
}
Comment on lines +550 to +561
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed one part of the TODO. It was not working properly before, so just uncommenting it will not make it work correctly no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up! I dug into the runtime code, and since .includes is syntactically valid here, I suspect the original issue was about reference equality (e.g. comparing a signal wrapper against a raw node causing false negatives). If that's the case, I can switch to .some() to check properly. Does that sound like the right fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have much insight on why this was commented but I suspect if the problem was just a reference equality it would've been fixed instead of commented. What I would do is git blame it, go check the pr that introduce it and try to understand why it was commented (possibly even asking whoever introduced it if it's not clear from the pr) and move on from there. Thanks for the effort 🤟🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes total sense. I'll check the git blame history to track down the original PR and understand the context for why it was disabled. Thanks for the tip! I'll report back with what I find. 🤜🤛


recent_async_deriveds.delete(signal);

Expand Down
Loading