Failed to execute 'px' on 'CSS': The provided double value is non finite. #24537
Closed
2 tasks done
Labels
duplicate
This issue or pull request already exists
There is an error with inline padding/margin props passed to when we pass {undefined} as value
Current Behavior 😯
When we pass the value
undefined/NaN
inside the padding/margin prop of the component, it throws an error"Failed to execute 'px' on CSS': The provided double value is non-finite"
Expected Behavior 🤔
It should just ignore the {undefined} value
Steps to Reproduce 🕹
https://codesandbox.io/s/material-ui-issue-forked-1943q?file=/src/Demo.js
Browser: ONLY in the latest chrome version (version 88)
Material-UI version: only in the @latest version, but not in @next
If you open the codesandbox, you can find specifically the issue is in the file
"jss-plugin-default-unit.esm.js"
line 5
var px = (0, $csb__jss.hasCSSTOMSupport) && CSS ? CSS.px : 'px';
in chrome 87 it evalues to 'px', meanwhile in chrome 88 it evalues to CSS.px, so it crashes when you pass undefined/NaN to CSS.px
Context 🔦
I think a lot of systems use @latest, and with chrome updates being automatic a lot of system could break if a value is passed conditionally. eg:
<Box p={case ? 2 : undefined}/>
The text was updated successfully, but these errors were encountered: