-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Cannot read property rules of undefined #1188
Comments
#1189 |
So, this issue brokes an application in production. Of course its my bad to use package alpha version in production, but here is a result. |
Could you please include more info about your setup and under which conditions you are using |
@HenriBeck I couldn't create a codesandbox with a reproducible example, but I can try to describe: I have a component with dynamic styles. This is FunctionComponent which uses Also, before I had an issue with dynamical styles. My styles didn't update properly. So I needed a full page reload to update CSS. This is weird. But I'm looking forward to trying to help you in fixing these issues. Now I resolved these issue using different classnames depends on Component props. |
The not updating of styles should be fixed in #1190 |
Cool, I'll update my jss versions and check. Thanks for the update. |
We haven't released a version with that fix yet |
@HenriBeck yes, I know. So I'm waiting for the new version and then update |
I've been having this problem too. It won't be fixed by #1190, it's a different problem. The crash can be triggered by using a dynamic style inside a media query e.g.: button: {
'@media (min-width: 0px)': {
color: () => 'red'
}
} The crash occurs if you unmount a component that uses this sheet, while there are still other instances mounted. Here's a codesandbox: https://codesandbox.io/s/jss-mq-dynamic-style-remove-ju7wr Just click "Remove" to crash it. @HenriBeck I think the problem here is that the |
I was linking your fix to this problem. I'm aware that this problem is completely unrelated to yours |
Yes but to clarify, my previous comment is all about this issue. The codesandbox above is new - I created it specifically for this issue because there was no sandbox yet to reproduce this bug. |
it affects us too |
Is there any update on this issue? |
The same is here! |
This is affecting my company's production site as well, any timeline on when a version with the fix will be released? |
@hartbeatnt you can submit a PR with a fix and then it will be released shortly after successful review |
Any update? Does anybody knows where is it ? |
Seem like a bad bug, does anyone want to create a test or/and a fix? |
@kof this can be used for a test https://github.com/nordnet/nordnet-ui-kit/pull/649/files |
Waiting for the new version too |
I think I found the reason for this problem. We met this issue by use react-hot-loader. When some component code change. webpack retranspile and make hot reload. Then the component use jss hook will show this error and will make our program broken down. It makes me really headache. After some debug. I found the parameter rule is undefined because the property dynamicRules on state not rewritten when state.sheet removes the rules. For details. In the picture following. We use addDynamicRules to add rulelist on the sheet and assigned to state.dynamicRules. And in effect clean up callback. Only remove all rules but forgot to reset property dynamicRules on state So. when the next effect hook execute. We can`t found the dynamicRules in rulelist because it`s already removed before. So I try to reset dynamicRules property and it works. I'm not sure the code above is intentional or it`s a bug. Hope someone can response. |
Created a minimal failing test for this. |
fix is merged, will be released in 10.0.1 |
Hi. Not sure how to reproduce locally or create a code snippet with a reproducible issue, but got this today 5 times on stage environment. It's a really weird and very important issue since I can't debug it
Hope you can help.
Thank you in advance
The text was updated successfully, but these errors were encountered: