-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
fix(dev): add param to route css so it is not deduped by react #14447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: f1c927d The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
Hi @joshuaellis, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
2f46daa
to
baf33ba
Compare
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
151ce80
to
37a4218
Compare
37a4218
to
31e26ac
Compare
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I looked into this and landed on a similar solution, but I also inspect the Vite manifest and only apply the workaround to href
values that are used in a dynamic import context elsewhere in the application. PR is here: #14447 if you're interested. It's been merged to dev and will be out in the next release.
Description
React dedupes CSS files that are identical, which is a good default in the case of vanilla react where multiple components might require the same chunk of css however in react router where the route may mount the css chunk first before lazy loaded components have loaded can cause those lazy loaded components to loose their styles when the page is navigated away from.
To solve this, we add a small hash param to route level CSS in the dev package. I used a hash as opposed to a search param because it doesn't download the same CSS twice but the deduping is no longer happening. We still fetch the CSS on route changes, but this is the same behaviour we have now in react-router so i've assumed this is fine.
I've left the branch on my fork with the failing test displayed in 14415, but otherwise modified it here to be a test to keep long term.
Related issues