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

Classes does not work for Components with special chars in display name #624

Closed
kof opened this issue Nov 13, 2017 · 6 comments
Closed

Classes does not work for Components with special chars in display name #624

kof opened this issue Nov 13, 2017 · 6 comments
Labels
bug It went crazy and killed everyone.

Comments

@kof
Copy link
Member

kof commented Nov 13, 2017

@luiz290788 commented on Mon Nov 13 2017

The new prefix for the generated classes that use the display name of the decorated components are not being sanitized.

For example:
Decorated class display name "SomeOtherDecorator(Test)"
Generated classes ".SomeOtherDecorator(Test)-root-0-1"
The parenthesis in the classes is causing the problems here.

Suggested solution: Parse the display name of the component to remove the special characters.


@kof commented on Mon Nov 13 2017

Or escape the chars.


@luiz290788 commented on Mon Nov 13 2017

I was checking the code and thinking about the issue, it seems to be a jss issue instead of a react-jss issue. What do you think?


@kof commented on Mon Nov 13 2017

Well, ultimately yeah, as we are using property names in classes, they can also contain everything. We just never had that issue over there.


@kof commented on Mon Nov 13 2017

Also the escaping needs to be done in dev mode only, because in production we build short class names.

@kof kof added the bug It went crazy and killed everyone. label Nov 13, 2017
@kof
Copy link
Member Author

kof commented Nov 13, 2017

I am going to use CSS.escape, since it is implemented in the most modern browsers and will be used in dev mode only. If once develops in a different browser, there is a good polyfill.

@kof
Copy link
Member Author

kof commented Nov 13, 2017

fixed and released

@rafaeltavares
Copy link

I'm facing problems with generated class names in production, using react-jss.
It seems that they need to be escaped.

image

@kof
Copy link
Member Author

kof commented Jan 18, 2018

@rafaeltavares please file a separate issue with codesandbox link

@iamstarkov
Copy link
Member

@rafaeltavares can you place injectSheet HoC after injectIntl one?

@rafaeltavares
Copy link

@iamstarkov I updated react-jss from version 8.2.0 to 8.2.1 and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It went crazy and killed everyone.
Projects
None yet
Development

No branches or pull requests

3 participants