Skip to content

fix(web): insert root hole content literally in renderToStream (#5275) - #5277

Open
O1sumitkumar wants to merge 1 commit into
solidjs:mainfrom
O1sumitkumar:fix/ssr-root-hole-dollar-5275
Open

O1sumitkumar wants to merge 1 commit into
solidjs:mainfrom
O1sumitkumar:fix/ssr-root-hole-dollar-5275

Conversation

@O1sumitkumar

Copy link
Copy Markdown

Fixes #5275

Summary

resolveRootHoles() in renderToStream filled each <!--rhN--> marker with html.replace(marker, content). With a string as the second argument, String.prototype.replace expands $`, $&, $' and $$, so rendered text containing them was corrupted (for example `$` became the HTML before the marker, and $& became the marker itself). Both calls now pass a function, () => content, whose return value is inserted literally. This is the same form shellEdit(s => s.replace(now, () => to)) already uses in this file.

Changeset added: @solidjs/web patch. No public API change.

How did you test this change?

  • Added two tests to packages/web/test/server/ssr-stream.spec.tsx (No Loading Boundary block): one where a root hole resolves to text with $`, $&, $' and $$, and one where the resolved content leaves a nested hole (the res.h.length branch). Both fail on main (e.g. received "Total: `<p _hk=1> 5 (<!--rh0-->amp; a…") and pass with the fix. Reverting only the second replace makes the nested-hole test fail again, so each branch is covered.
  • pnpm i, pnpm --filter @solidjs/compiler run build, pnpm build, then pnpm test in packages/web: client 2043 passed / 6 expected fail, server 2265 passed / 3 expected fail, hydrate 818 passed / 7 expected fail, no failures.
  • prettier --check is clean on the changed files.
  • Not run: the repo-wide pnpm test (other packages' suites and type tests), the Babel/LOWER_SHOW CI variants, and the integration tests.

This change was prepared with AI assistance (Grok Bot, an AI agent). I reviewed the diff and the test results.

@changeset-bot

changeset-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 27a04b1

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

This PR includes changesets to release 5 packages
Name Type
@solidjs/web Patch
@solidjs/diagnostics Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal 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

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.

renderToStream: rendered content with $`, $& or $' is corrupted when a root hole is filled (String.replace patterns)

1 participant