Skip to content

Conversation

Copy link

changeset-bot bot commented Oct 21, 2025

🦋 Changeset detected

Latest commit: de3b900

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

This PR includes changesets to release 11 packages
Name Type
@react-router/dev Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch
react-router Patch
react-router-dom Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve 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

@markdalgleish markdalgleish added the alpha-release Used by maintainers to trigger a Stage 2 (alpha) release on a PR label Oct 22, 2025
Copy link
Contributor

Alpha release created: 0.0.0-experimental-de3b900

⚠️ Note: This release was created from the HEAD of this branch so it may contain commits that have landed in dev but have not been released yet depending on when this branch was created. You can run the following command to see the commits that may not have been released yet:

git log --pretty=oneline [email protected]

@github-actions github-actions bot removed the alpha-release Used by maintainers to trigger a Stage 2 (alpha) release on a PR label Oct 22, 2025
@markdalgleish markdalgleish merged commit 0f942ba into dev Oct 22, 2025
10 checks passed
@markdalgleish markdalgleish deleted the markdalgleish/fix-missing-dynamic-css branch October 22, 2025 05:23
Comment on lines +398 to +413
.map((href) => {
let publicHref = `${ctx.publicPath}${href}`;
// If this CSS file is also dynamically imported anywhere in the
// application, we append a hash to the href so Vite ignores it when
// managing dynamic CSS injection. If we don't do this, Vite's
// dynamic import logic might hold off on inserting a new `link`
// element because it's already in the page, only for React Router
// to remove it when navigating to a new route, resulting in missing
// styles. By appending a hash, Vite doesn't detect that the CSS is
// already in the page and always manages its own `link` element.
// This means that Vite's CSS stays in the page even if the
// route-level CSS is removed from the document. We use a hash here
// because it's a unique `href` value but isn't a unique network
// request and only adds a single character.
return allDynamicCssFiles.has(href) ? `${publicHref}#` : publicHref;
}),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the core of the fix. The rest of the code is in service of this workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant