-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Incorrect "Rule is not linked" warning on server when using function rules #1143
Comments
I think the option |
Removing On the other hand, this issue will go away if we stop calling if (sheet && sheet.attached) {
warning(false, '[JSS] Rule is not linked. Missing sheet option "link: true".')
} |
@felthy is this still an issue? |
@kof it is fixed when using I think the HOC should be updated to not call |
Still get this annoying warning on the server side. Any solutions? |
Same here guys 🙋♂️ |
Tried the solutions that were mentioned above, but no luck so far. Is anyone else also using Babel, styled-components and/or NextJS? I'm feeling the errors become less if I temporarily shut a part down, although more research required. |
I am running into this problem myself and build a minimal viable repo of it. I could trace the Problem to I am using NextJS in my project, and both my
My dependencies: "dependencies": {
"jss": "^10.7.1",
"jss-plugin-camel-case": "^10.7.1",
"jss-plugin-global": "^10.7.1",
"jss-plugin-vendor-prefixer": "^10.7.1",
"next": "11.0.1",
"normalize-jss": "^4.0.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-jss": "^10.7.1"
} When I start the dev server I get this warning
exactly twice. For each refresh, I get this warning twice. The solutions mentioned here did not help. |
i'm facing the same issue, any luck ? |
im facing the same issue even with |
Exact problem. Any news? Next 12.1.0 |
Expected behavior:
No warning.
Describe the bug:
All function rules are triggering the following warning when run on the server: Warning: [JSS] Rule is not linked. Missing sheet option "link: true".
I've traced the problem back to the fact that in
Jss.js
,options.Renderer
is set tonull
when not in the browser. This eventually leads to the code inBaseStyleRule.prop()
falling through to the warning becausethis.renderable
andthis.renderer
are not defined at styleRule.js#L71.The warning is incorrect: the sheet option
link
is actuallytrue
, and the fact thatthis.renderable
andthis.renderer
are not defined is correct because on the server, we don't need anything to happen inprop()
because we'll calltoString()
later the render the CSS.I would contribute a test to replicate the bug, but I don't think it's possible with the existing karma setup because we need
'is-in-browser'
to reportfalse
to trigger the bug. So, I've written a jest test (see link below) to demonstrate.Codesandbox link:
https://repl.it/@felthy/JssInvalidWarningDuringSSR
Versions:
jest test source:
The text was updated successfully, but these errors were encountered: