cssinjs / cssinjs/jss

Latest version doesn't work with next.js example

Open
#1,328 4 comments 3 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__Expected behavior:__
Have a working example app for Next.js

__Describe the bug:__
https://github.com/zeit/next.js/tree/master/examples/with-react-jss

It looks like the example app in the Next.js repository is using v10.0.0-alpha9.
Apparently the example doesn't work with the actual v10.0.0 release, something must have changed.

The exact issue is only visible when producing a production build in Next.js.
The styles are visible for a very short duration until they get removed.

Removing the logic in https://github.com/zeit/next.js/blob/master/examples/with-react-jss/pages/_app.js
fixes the issue, but I am not sure if that's intended.

It seems like the naming is not matching, this is what I get generated into my header:
```html

.Component-container-0-1-1 {
margin-top: 100px;
text-align: center;
}
.Component-header-0-1-2 {
font-size: 24px;
line-height: 1.25;
}

```

Even though the rendered div looks like this:
```html



Example on how to use react-jss with Next.js



```

When I run the app with `yarn run dev` everything works fine though...

__Codesandbox link:__

Basically exactly the example app on the latest react-jss version
See https://codesandbox.io/s/blissful-tree-r1zxx

__Versions (please complete the following information):__
- jss: >10.0.0-alpha9
- Browser: all browsers
- OS: all OS
Feel free to add any additional versions which you may think are relevant to the bug.

Contributor guide

Open the contributing guide

Research direction

Start with the Next.js with-react-jss example and inspect pages/_app.js, then reproduce the issue with a production build rather than yarn run dev. Compare the generated JSS names with the rendered class names and the alpha9 versus v10.0.0 behavior. Done means the example builds for production and its styles remain applied after rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.