Skip to content

fix SSR issue in v2 and not in vendor - #394

Merged
mxstbr merged 5 commits into
styled-components:v2from
kristojorg:v2
Jan 21, 2017
Merged

mxstbr merged 5 commits into
styled-components:v2from
kristojorg:v2

Conversation

@kristojorg

Copy link
Copy Markdown
Contributor

This is the same issue I was fixing here, but solved on the right branch and not in /vendor.

@kristojorg

Copy link
Copy Markdown
Contributor Author

Not sure what's going on with the CI checks... if you can tell me what it's failing on I'll do my best to fix!

@mxstbr

mxstbr commented Jan 20, 2017

Copy link
Copy Markdown
Member

This looks great! The CI is failing due to a simple linting error:

/home/travis/build/styled-components/styled-components/src/models/StyleSheet.js
  28:11  error  Extra semicolon  semi

(you can replicate this locally by running npm run lint—this automatically make sure the codestyle is consistent)

@mxstbr
mxstbr requested a review from chiefjester January 20, 2017 15:51
@kristojorg

Copy link
Copy Markdown
Contributor Author

Okay great, removed that !

@chiefjester chiefjester left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just need to add a test. I hope you don't mind.

Comment thread src/models/StyleSheet.js
}
getCSS({ min = true }: { min: boolean } = {}) {
return this.styleSheet.rules().map(rule => rule.cssText).join(min ? '' : '\n')
return this.styleSheet.sheet ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind adding a test if SSR doesn't have any styles?

@kristojorg

Copy link
Copy Markdown
Contributor Author

Okay added tests! First time doing that as well, let me know if it doesn't look right.

@mxstbr-bot

mxstbr-bot commented Jan 20, 2017 •

Copy link
Copy Markdown
Warnings
⚠️ There are library changes, but not tests. That's OK as long as you're refactoring existing code

Generated by 🚫 dangerJS

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One tiny comment then I think we can ship this.

Comment thread src/models/test/StyleSheet.test.js Outdated
})

it('should not throw an error if no styled-components are rendered', () => {
const css = styleSheet.getCSS();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start, but this would be even better:

expect(() => styleSheet.getCSS()).toNotThrow()

To make it very clear what this should do 😊

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, just fixed it :)

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, great work!! 🎉 thanks so much!

@mxstbr
mxstbr merged commit 24a4fac into styled-components:v2 Jan 21, 2017
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

Successfully merging this pull request may close these issues.

4 participants