Skip to content

fix: invalidate dev manifest CSS in isolated SSR runners - #417

Open
everton-dgn wants to merge 1 commit into
solidjs:nextfrom
everton-dgn:fix/dev-manifest-css-cache
Open

everton-dgn wants to merge 1 commit into
solidjs:nextfrom
everton-dgn:fix/dev-manifest-css-cache

Conversation

@everton-dgn

Copy link
Copy Markdown

Fixes #415

The HTTP bridge returns fresh CSS after an edit, but an isolated SSR runner keeps the first successful response in its manifest cache. Later SSR responses therefore retain the old styles until that module is evaluated again.

Send a custom event on the server environment's HMR channel after Vite invalidates its transforms. The manifest clears its cache when it receives that event. Generation checks prevent older requests from restoring stale entries or deleting newer pending work. Warm lookups still return synchronously, as required by SSR render retries.

The new tests use the same manifest instance throughout each edit. They cover delayed watchChange hooks, overlapping requests, failed requests and listener replacement, and run in CI after the plugin build.

Validation:

  • pnpm build passed, including declaration generation.
  • All seven cache regression tests passed. The original six failed before the fix; the delayed watchChange test also failed against the first version of the fix.
  • The complete CSS matrix passed (87 development and production assertions), as did the existing HTTP bridge tests (21 assertions).
  • With Nitro's actual dev worker, an edit from 18px to 36px now appears in the next SSR response without a restart or hydration. This reproduction delays manifest loading until HTTP startup to isolate Dev manifest bridge keeps stale CSS after an edit #415 from the separate startup bug in Dev manifest loses lazy CSS when imported before HTTP startup #414.
  • The root pnpm test command could not run its cases locally: Cypress was killed with SIGKILL during its startup smoke test on macOS.

Invalidation uses the runner's HMR transport. Workerd and configurations with HMR disabled were not exercised.

Related: #414 covers imports before HTTP startup. The two fixes touch the same resolver; combining them requires preserving both the generation check and the !bridgeMissing cache guard. Each fix was tested separately.

Send cache invalidation over the server environment's HMR channel after
Vite processes a file change. Guard pending responses by generation so
older work cannot restore stale CSS or remove a newer pending request.
Keep warm lookups synchronous for SSR render retries.

Add regression coverage for CSS edits, delayed watchChange hooks,
overlapping requests, failures and listener replacement.

Fixes solidjs#415
@changeset-bot

changeset-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 81555d8

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 Oct 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 81555d8

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