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

generateClassName prefix not working in Production #1042

Closed
vinayg-cp opened this issue Feb 22, 2019 · 7 comments
Closed

generateClassName prefix not working in Production #1042

vinayg-cp opened this issue Feb 22, 2019 · 7 comments
Labels
question Documentation is not good enough.

Comments

@vinayg-cp
Copy link

Expected behavior:
When using the generateClassName function in production. We expect the stylesheet.options to be populated with appropriate meta data and classNames.
As a result all the class names are prefixed with undefined,

Describe the bug:
image

Class names are undefined:
image

In contrast in development it works fine:
image

And it is prefixed with appropriate class name in development mode.
image

The stylesheet options is not populated and instead it is undefined.

Codesandbox link:
Please create a codesandbox.io with the issue. Make it as minimal as possible as this will help us find the bug quicker.
Unfortunately it happens only in production and not in development.
So I doubt in codesandbox it will be exactly reproducible.

Versions (please complete the following information):

  • jss: 8.6.1
  • Browser [e.g. chrome, safari]: Chrome 72+
  • OS [e.g. Windows, macOS]: Windows, Linux

Code Snippets:

image

@kof
Copy link
Member

kof commented Feb 22, 2019

Without some reproduction we won't have any prio on this. It should be possible to use production mode on codesandbox.

@vinayg-cp
Copy link
Author

Noted will try to provide a minimal reproducible code on codesandbox.io

@HenriBeck
Copy link
Member

The issue is that we pass undefined in production here. You shouldn't expect to have a classNamePrefix on the stylesheets options (typings is located here).

In v10 we replaced undefined with an empty string.

@HenriBeck HenriBeck added question Documentation is not good enough. and removed needs reproduction labels Feb 23, 2019
@vinayg-cp
Copy link
Author

The issue is that we pass undefined in production here. You shouldn't expect to have a classNamePrefix on the stylesheets options (typings is located here).

In v10 we replaced undefined with an empty string.

Hi,

Then where should we expect classPrefix to be present in production?

@HenriBeck
Copy link
Member

Not at all, classNamePrefix can also be undefined in development (though that's not the case for react-jss)

@micaste
Copy link

micaste commented Sep 9, 2019

@kof I have some reproduction for this.

This code sandbox has a small react-jss setup using the following example:

const jss = create(preset());
...
<JssProvider classNamePrefix="test-prefix" jss={jss}>
...

Link to the sandbox: https://codesandbox.io/s/react-jss-playground-0e14b
In dev mode, the classnames look like test-prefixComp-title-0-2-2.
Screenshot 2019-09-09 at 15 52 16

In prod mode, the classnames look like test-prefixundefined022.
Link to the code deployed in production mode: https://csb-0e14b.netlify.com/

Screenshot 2019-09-09 at 15 51 27

@micaste
Copy link

micaste commented Sep 9, 2019

Actually I found that this was fixed in #901. I understand that there is no point backporting the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Documentation is not good enough.
Projects
None yet
Development

No branches or pull requests

4 participants