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

Styled components does not hot reload #2599

Closed
bobissict opened this issue Oct 24, 2017 · 15 comments
Closed

Styled components does not hot reload #2599

bobissict opened this issue Oct 24, 2017 · 15 comments

Comments

@bobissict
Copy link

I'm using the Gatsby starter blog with styled components and the hot reloading does not work. It works for everything else, changing JSX etc but it just won't pick up changes from styled components forcing me to have to manually reload the page.

I've tried a bunch of things but nothing seems to work.

I'd appreciate any help as it's driving me crazy.

@danoc
Copy link
Contributor

danoc commented Oct 24, 2017

@bobissict – Are you seeing this warning in your console?
image

I haven't dug into this at all but see this warning often.

@bobissict
Copy link
Author

super weird, i have another gatsby site that I setup with the gatsby-blog-starter which the hot reloading works. I just ended up cloning that site and using it.

Gonna just mark this as closed unless I can recreate the issue again

@KyleAMathews
Copy link
Contributor

There was a recent PR that fixed hot reloading for some stuff so perhaps the older site just needed upgraded.

@pgegenfurtner
Copy link
Contributor

I've got the same problem here. I created a new gatsby project based of the default starter, then added the gatsby-plugin-styled-components, imported styled-components and created the first one in pages/index.js

When I create a new styled component and use it, hot reloading works fine, but as soon as I change a property of a already loaded styled-component, the hot reload doesn't work and I have to manually refresh.

I can see the classes of the component hot reloading, but the css itself stays old.

I'm on the newest gatsby version (1.9.80)

@monsieurnebo
Copy link
Contributor

monsieurnebo commented Nov 3, 2017

Same problem here ✋

I can see the concerned class beeing updated, but the new CSS properties don't show up.

Versions:

refactornator added a commit to refactornator/gatsby-blog that referenced this issue Nov 5, 2017
@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews reopened this Nov 6, 2017
@KyleAMathews
Copy link
Contributor

If you downgrade styled components to v2.2.0 it works apparently.

@monsieurnebo
Copy link
Contributor

@KyleAMathews I just tested with v2.2.0, it's working fine.

@greglobinski
Copy link
Contributor

@KyleAMathews Thank you

@Nick-vr
Copy link

Nick-vr commented Nov 25, 2017

Downgrading to v2.0.0 did not fix the problem for me.

@nthndnn
Copy link

nthndnn commented Nov 25, 2017

Similarly to @Nick-vr, I'm also having this issue

@ziyafenn
Copy link

@nathanjdunn @Nick-vr uninstall the styled-components package and run this again:
npm install --save gatsby-plugin-styled-components [email protected]

@Nick-vr
Copy link

Nick-vr commented Nov 27, 2017

@ziyafenn Thank you!

@monsieurnebo
Copy link
Contributor

monsieurnebo commented Nov 30, 2017

Seems fixed by [email protected].

@KyleAMathews
Copy link
Contributor

Great! Closing this now.

refactornator added a commit to refactornator/gatsby-blog that referenced this issue Feb 9, 2020
refactornator added a commit to refactornator/gatsby-blog that referenced this issue Feb 19, 2020
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

No branches or pull requests

9 participants