Skip to content

fix: defer hydration until suspense stream is parsed - #2304

Closed
birkskyum wants to merge 1 commit into
solidjs:mainfrom
birkskyum:fix/suspense-stream-hydration
Closed

fix: defer hydration until suspense stream is parsed#2304
birkskyum wants to merge 1 commit into
solidjs:mainfrom
birkskyum:fix/suspense-stream-hydration

Conversation

@birkskyum

Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

The client entry module is marked async, so it can hydrate while the HTML parser is still waiting for streamed Suspense content. Hydration can retain references to fallback route DOM that the stream later replaces. After reloading a detail route and navigating back, both the stale detail route and the new root route can remain rendered.

What is the new behavior?

The client module now uses the default deferred execution of module scripts. It is still discovered and fetched when the parser encounters it, but hydration waits until the streamed document has been parsed.

A Playwright regression reproduces the reload-and-back sequence from #2297 and verifies that only the root route remains.

Other information

Validation completed:

  • pnpm --filter @solidjs/start typecheck
  • pnpm --filter @solidjs/start test:ci (98 tests)
  • pnpm --filter tests build
  • pnpm --filter tests unit:ci (5 tests)
  • Playwright Chromium e2e suite (38 tests)
  • Focused regression in standard and bundled-dev configurations

@changeset-bot

changeset-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f236571

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

This PR includes changesets to release 1 package
Name Type
@solidjs/start 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

@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit f236571
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a86ffd14f576d0008c08338
😎 Deploy Preview https://deploy-preview-2304--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2304

commit: f236571

@birkskyum
birkskyum marked this pull request as ready for review August 20, 2026 13:21
@birkskyum
birkskyum requested a review from brenelz August 20, 2026 13:21
@birkskyum
birkskyum force-pushed the fix/suspense-stream-hydration branch from 0d52e55 to f236571 Compare August 20, 2026 13:23
<script
type="module"
nonce={nonce}
async

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i feel usually this is async. This is what was causing problems?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems like it @huseeiin can you verify this works?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like it @huseeiin can you verify this works?

yes its fixed

@ryansolid

ryansolid commented Aug 21, 2026

Copy link
Copy Markdown
Member

DO NOT MERGE.

This is indictive of another bug.. a core bug most likely and probably one annoying to fix. But fundamentally we definitely do not want to block hydration until document completion. It basically negates the value of streaming as the uncanny valley covers the whole time window. Script entry should be async not deferred.

In 2.0 we have smart snapshotting. In 1.x early interaction is supposed to bail out of hydration and resume the boundary as client rendering. But in all cases hydrating as soon as possible is definitely desired. This is part of the design contract.

So glad I noticed before merge. Vercel accidentally did this on their first RSC edge streaming demos and people attributed it to Server Components being slow. React core team scrambled to figure out the issue. I actually identified it for them in their PR. Honestly Im not sure perception ever completely recovered from that.

@birkskyum
birkskyum marked this pull request as draft August 21, 2026 11:01
@birkskyum birkskyum closed this Aug 21, 2026
@ryansolid

Copy link
Copy Markdown
Member

If guys want .. make an issue against Dom Expressions probably with the context of the original bug this was trying to fix.

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.

[Bug?]: two pages render simultaneously

4 participants