Skip to content

fix: retain content-addressed development CSS assets - #154

Draft
ScriptedAlchemy wants to merge 2 commits into
mainfrom
codex/fix-css-preload-restoration
Draft

ScriptedAlchemy wants to merge 2 commits into
mainfrom
codex/fix-css-preload-restoration

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Refs #153. Serve development entry and route CSS through retained content-addressed paths so a document preload cannot revive edited bytes after an exact source restoration.

  • Keep genuine ownership-removal reloads, but publish CSS byte-version changes through the committed-manifest HMR-idle queue.
  • Replay the last committed entry/route manifest on reconnect.
  • Disable the extract loader's fallback HMR code via the NormalModule loader hook only for the web development environment with Router HMR enabled. Router owns stylesheet updates there; the fallback's global link scan must not remove React-owned DOM nodes. Other loader pipelines, production, and RSC are unchanged by this hook.
  • Include a Changeset and real-browser edit/preload/restore/remount tests for plain CSS and Vanilla Extract, checking retained bytes, document identity, input state, and browser errors.

The reproduction candidate linked from #153 informed this implementation. Direct immutable paths replace its canonical URL/query middleware. No dependencies or native binaries are patched.

Validation at 71e5e3a

  • Build and full typechecking passed.
  • All 844 core tests passed (TMPDIR=/private/tmp avoids macOS temporary-path alias assertions).
  • All 15 CSS/lazy-loading browser matrix tests passed, including both CSS-with-JS cases that failed original CI.
  • Both plain-CSS and Vanilla Extract exact-restoration browser regressions passed.
  • Broader local HMR tests have shown loader-update timeouts at different steps; those results are not reported as passing. Full ecosystem and fresh CI validation are in progress. Keep draft until the final head is green and these checks are accounted for.

The original canonical-query approach reproduced a native Rspack/React removeChild conflict. Direct paths avoided that path; the subsequent Vanilla Extract fallback conflict is addressed by the loader hook in 71e5e3a. Upstream Rspack #15879 remains useful but this implementation no longer requires its unreleased patch to pass the CSS matrix.

#140 remains independent and blocked on Rsbuild #8496; this PR does not implement runtime reuse.

@pkg-pr-new

pkg-pr-new Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/rsbuild-plugin-react-router@71e5e3a

commit: 71e5e3a

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark results

Case Base Head Delta
build-256-ssr 1584.7 ms 1582.4 ms -0.1%
dev-48-ssr 699.0 ms 712.9 ms +2.0%

@codspeed

codspeed Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 1 untouched benchmark
⏩ 2 skipped benchmarks1


Comparing codex/fix-css-preload-restoration (71e5e3a) with main (a13d67c)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ScriptedAlchemy

Copy link
Copy Markdown
Collaborator Author

The CSS CI failure is fixed locally by disabling extract-loader fallback HMR through the NormalModule loader hook only in the web development environment where Router handles committed CSS manifests. No dependency source patch or test skip is used. All 15 CSS/lazy-loading matrix tests pass, including both Vanilla Extract state-preservation cases. Added exact edit/preload/restore coverage for Vanilla Extract; both variants pass. Build, full typechecking, and 844 core tests pass. A broader local HMR run has hit loader-update timeouts and remains under investigation; the PR stays draft while CI and broader validation run.

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