Skip to content

fix: resume empty placeholders via a unified text resume marker - #4071

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-fix-empty-placeholder-vhgzim
Sep 1, 2026
Merged

fix: resume empty placeholders via a unified text resume marker#4071
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-fix-empty-placeholder-vhgzim

Conversation

@DylanPiercey

@DylanPiercey DylanPiercey commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Supersedes #4070.

A placeholder that rendered empty on the server could resume against the wrong DOM node (e.g. <div/>${value} with value starting empty claimed the <div> as its text node), because resume guessed the node from the marker's previous sibling and <!> separators only covered some positions (#3143, #4070). A multi-node $!{value} also resumed with only its last node claimed, orphaning the rest on the first update.

Serialized placeholders now write a single _text_resume/_html_resume call instead of _escape/_unescaped plus _el_resume: empty text emits an EmptyText marker and resume creates the text node itself, non-empty text claims its previous sibling unconditionally, and multi-node unescaped markup is bracketed with HtmlStart/HtmlEnd markers so resume reconstructs the full range. Separators (and _sep) remain only where non-empty text would merge with a preceding text node. The new resume handling is latched behind _html usage and single ordered symbol comparisons, so the resume bundle floor shrinks along with the SSR output.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8274cd5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/runtime-tags Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.75%. Comparing base (a0d1bc1) to head (8274cd5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4071      +/-   ##
==========================================
- Coverage   90.78%   90.75%   -0.03%     
==========================================
  Files         424      424              
  Lines       20447    20461      +14     
  Branches     3874     3877       +3     
==========================================
+ Hits        18562    18570       +8     
- Misses       1323     1330       +7     
+ Partials      562      561       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-fix-empty-placeholder-vhgzim branch 7 times, most recently from 95d8734 to 31824f2 Compare September 1, 2026 15:17
… markers

Replaces the `_escape`/`_unescaped` + `_el_resume` pair a serialized
placeholder wrote with a single `_text_resume`/`_html_resume` call.

When the rendered text is empty it writes only a new `EmptyText` resume
marker, so resume creates the text node instead of guessing a neighbor —
fixing resume claiming a preceding element/input (or a section edge) as
the placeholder's text node. Non-empty text claims its previous sibling
unconditionally, letting the client resume runtime drop its node
heuristic, and `<!>` separators are now emitted at runtime only when
non-empty text would merge with a preceding text node (`_sep` removed).

Unescaped markup that parses to multiple top-level nodes is bracketed
with `HtmlStart`/`HtmlEnd` markers so resume claims the whole range and
restores the last-child accessor `_html` tracks client side, instead of
claiming only the final node and orphaning the rest on the first update.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-fix-empty-placeholder-vhgzim branch 2 times, most recently from fed6ddc to 8274cd5 Compare September 1, 2026 15:25
@DylanPiercey
DylanPiercey merged commit 1080f81 into main Sep 1, 2026
10 of 11 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant