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

[universal-redux] Global styles applied several times now #11

Closed
0xsven opened this issue Nov 20, 2016 · 6 comments
Closed

[universal-redux] Global styles applied several times now #11

0xsven opened this issue Nov 20, 2016 · 6 comments
Labels

Comments

@0xsven
Copy link
Contributor

0xsven commented Nov 20, 2016

After your latest bug fix (moving globalInjects to componentWillMount) global styles are applied several times on the server.

On your demo page (https://arc.diegohaz.com/) the global styles are applied 3 times. In my app which has a little more global styles, they are applied up to 12 times. It seems like this grows over time.

I will investigate a little and post my findings.

@diegohaz
Copy link
Owner

Maybe we need to move injectGlobal to outside the component. I'm not able to test this right now. Can you see if this works?

@0xsven
Copy link
Contributor Author

0xsven commented Nov 20, 2016

I just realised that it adds up with every page refresh

edit: what do you mean with outside of the component?

@diegohaz
Copy link
Owner

It makes sense. App is mounted on every page refresh. the *Mount methods aren't the right place forinjectGlobal indeed.

@diegohaz
Copy link
Owner

I mean something like this:

injectGlobal`
body {
margin: 0;
}
`

class App extends Component {
...

@0xsven
Copy link
Contributor Author

0xsven commented Nov 20, 2016

That works!

@diegohaz
Copy link
Owner

Nice! Would you mind to send a PR with this on master (I merge with other branches later)?

The files are src/components/App.js and src-clean/components/App.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants