__Expected behavior:__
No crash
__Describe the bug:__
When rendering:
import * as React from "react";
import { createUseStyles } from "react-jss";
const useStyles = createUseStyles((t) => ({
container: {
margin: NaN
}
}));
export default function App() {
useStyles();
return <div />;
}
Chrome 88 crashes. CSS.px(NaN) isn't flying well.
TypeError: Failed to execute 'px' on 'CSS': The provided double value is non-finite.
__Codesandbox link:__
https://codesandbox.io/s/react-jss-ts-forked-nl2rf?file=/src/App.tsx
__Versions (please complete the following information):__
I have investigated the issue from https://github.com/mui-org/material-ui/issues/24519 and https://github.com/mui-org/material-ui/issues/24182. I'm not sure it's worth fixing here but I thought it would be interesting to report anyway.
It fails because typeof NaN === 'number':
The fix should be straightforward.
We are experiencing this issue too. Happy to help out with testing if needed
Fix made in https://github.com/cssinjs/jss/pull/1446. At this point, it's outside of the control of Material-UI.
Thanks @oliviertassinari & @kof, appreciate the work you guys did to figure this one!
Most helpful comment
Released https://github.com/cssinjs/jss/releases/tag/v10.5.1