Skip to content

fix: full-reload on document shell and server-only module edits - #336

Open
ryansolid wants to merge 1 commit into
nextfrom
document-hmr-full-reload
Open

fix: full-reload on document shell and server-only module edits#336
ryansolid wants to merge 1 commit into
nextfrom
document-hmr-full-reload

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Summary

Fixes solidjs/solid#3151 (Document.jsx edits don't HMR or reload).

Two sides, both in dev serving:

  • Document shell declines HMR. The generated SSR client entry hydrates the whole document through the resolved start.document / src/Document.* module, so no refresh-boundary component swap can ever apply an edit to it — updates were accepted and silently absorbed. The document module's client compile now skips the refresh boundary and appends a self-accept + invalidate() footer, so a save full-reloads the page. Config-driven off the already-resolved document id — no source sniffing.
  • Server-only edits reload the browser. The hotUpdate hook suppresses server-environment updates to keep full-reload messages from racing client HMR — but a file with no modules in the client graph (client-mode document shells, authored entry-server, start.middleware) has no client update to race with, and staying silent leaves the browser rendering stale server output. Those now send a browser full-reload.

Test plan

  • Verified live against examples/start-ssr: document client compile carries the decline footer and no refresh boundary (SSR compile unaffected); App.tsx keeps its normal refresh boundary; editing src/middleware.ts sends the browser a full-reload; editing App.tsx sends a plain HMR update with no full-reload.
  • examples/start-ssr harness modes dev, document, babel-hmr pass; middleware mode has one pre-existing failure ("Unknown server function") that reproduces on a clean tree.

Made with Cursor

…djs/solid#3151)

The document shell hydrates the whole document, so no refresh-boundary
component swap can ever apply an edit to it — updates were accepted and
silently absorbed. The client compile of the resolved start.document /
src/Document.* module now declines HMR (self-accept + invalidate), so a
save full-reloads the page.

Separately, server-environment hot updates for files with no modules in
the client graph (client-mode documents, authored entry-server,
middleware) now send a browser full-reload instead of being suppressed:
the suppression protects client HMR from full-reload races, but a
server-only file has no client update to race with — staying silent just
leaves the browser rendering stale server output.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a7ff44

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

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@336

commit: 3a7ff44

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