[ButtonBase] Regression in 3.1.2 causes error "Cannot read property 'focusVisible' of null"
See original GitHub issueFor whatever reason, upgrading from 3.1.1 to 3.1.2 causes my app to stop functioning. The full error message that I’m receiving:
TypeError: Cannot read property ‘focusVisible’ of null at getDerivedStateFromProps (ButtonBase.js:353) at wi (vendor.js:55) at Ni (vendor.js:55) at Qi (vendor.js:55) at Zi (vendor.js:55) at Co (vendor.js:55) at Lo (vendor.js:55) at la (vendor.js:55) at ua (vendor.js:55) at ko (vendor.js:55)
Updating getDerivedStateFromProps
like so fixes the issue: https://github.com/alexplumb/material-ui/commit/40c82b80bcec82307691c936554925a09c37c6c2
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Including Button
, IconButton
, or ButtonBase
in my application should display the specified button.
Current Behavior
A white screen appears and the error in the title appears in the console log
Steps to Reproduce
Unable to reproduce in a code sandbox or create-react-app. Seems to only happen in my own environment.
Context
Your Environment
Tech | Version |
---|---|
Material-UI | 3.1.2 |
React | 16.5.2 |
Redux | 4.0.1 |
Browser | Chrome 69.0.3497.81 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
I was able to resolve it by deleting my node_modules folder, package-lock.json, and re-running npm install in my project. The fix ended up being pretty simple but the bug seems to be pretty pervasive - I think it would be wise to add a check to these
getDerivedStateFromProps
calls anyway.Huh - totally missed that - my bad. If I read more closely, I would have saved hours of debugging. Oh well, good experience learning react internals.