Skip to content
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

Passing explicitly imported components to Route.page breaks css injection order #859

Open
biphobe opened this issue Jul 18, 2020 · 0 comments
Labels

Comments

@biphobe
Copy link
Contributor

biphobe commented Jul 18, 2020

Given this setup:

  • NotFoundPage .js
import "./NotFoundPage.scss";
export default () => null;
  • Routes.js
<Route notfound page={ NotFoundPage } />
  • index.js:
import "./index.scss"
...
ReactDOM.render(... <Routes /> ...)

Then the css injection order in which css file contents are being put as <style> tags in the document header would be following:

  1. index.js > index.scss
  2. NotFoundPage.js > NotFoundPage.scss

If, however, we omit the Page autoimporting that happens behind the scenes and import the component which is being used as Route.page by adding an import explicitly to Routes.js:

import NotFoundPage from "./NotFoundPage";

Then css injection order changes into the following one:

  1. NotFoundPage.js > NotFoundPage.scss
  2. index.js > index.scss

... which can break page styles as it changes the specificity by changing the order in which rules are being applied onto the document.

@jtoar jtoar added bug/repro-available A reproduction exists and needs to be confirmed v1/priority and removed v1/for-consideration labels Jun 9, 2021
@thedavidprice thedavidprice added the bug/confirmed We have confirmed this is a bug label Sep 29, 2021
@jtoar jtoar added help wanted and removed bug/repro-available A reproduction exists and needs to be confirmed labels Dec 9, 2021
@jtoar jtoar removed the v1/priority label Apr 15, 2022
@jtoar jtoar changed the title Passing explicitly imported components as Route.page breaks css injection order Passing explicitly imported components to Route.page breaks css injection order Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

3 participants