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

fix cGS + HMR #2007

Merged
merged 7 commits into from Sep 14, 2018

Conversation

Projects
None yet
2 participants
@probablyup
Contributor

probablyup commented Sep 13, 2018

This was a really weird one. I still don't know why this works,
but it does and it's the only impl that did.

Fixes the issue noted here: #1969 (comment)

fix cGS + HMR
This was a really weird one. I still don't know why this works,
but it does and it's the only impl that did.

@probablyup probablyup requested a review from styled-components/core Sep 13, 2018

* caching the closure variables via statics and then persisting the statics in
* state works across HMR where no other combination did. ¯\_(ツ)_/¯
*/
this.state = {

This comment has been minimized.

@amankkg

amankkg Sep 14, 2018

I wonder if count += 1 can be moved to cDM? The only possible difference I see is for some SSR scenarios...

state = {
  globalStyle: this.constructor.globalStyle,
  styledComponentId: this.constructor.styledComponentId,
}

componentDidMount() {
  count += 1
}
@probablyup

This comment has been minimized.

Contributor

probablyup commented Sep 14, 2018

@probablyup probablyup force-pushed the fix-cGS-HMR branch from bada0e8 to 4cd7bde Sep 14, 2018

@probablyup probablyup merged commit 5c13b1e into develop Sep 14, 2018

2 checks passed

bundlesize ./dist/styled-components.min.js: 14.96KB < maxSize 16KB (gzip)(1.3KB smaller than master, good job!)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@probablyup probablyup deleted the fix-cGS-HMR branch Sep 14, 2018

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