question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'pulsate' of undefined in ButtonBase component

See original GitHub issue

In some cases, after ‘Esc’ button press, mouse click on ‘IconButton’ throws exception (if pause between press Esc button and mouse click is short).

  • This is not a v0.x issue.
  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

No component crash

Current Behavior 😯

Component crash with error:

Uncaught TypeError: Cannot read property 'pulsate' of undefined
    at ButtonBase.componentDidUpdate (ButtonBase.js?0386:268)
    at commitLifeCycles (react-dom.development.js?61bb:16879)
    at commitAllLifeCycles (react-dom.development.js?61bb:18219)
    at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:149)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:199)
    at invokeGuardedCallback (react-dom.development.js?61bb:256)
    at commitRoot (react-dom.development.js?61bb:18427)
    at completeRoot (react-dom.development.js?61bb:19884)
    at performWorkOnRoot (react-dom.development.js?61bb:19813)
    at performWork (react-dom.development.js?61bb:19721)

Steps to Reproduce 🕹

  1. Press Esc button
  2. Click on IconButton

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v3.9.2
React 16.8.1
Browser Google chrome
TypeScript yes
etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Jul 31, 2019

I have seen 2 issues with your reproduction. 1. It’s using an invalid a > button HTML structure. 2. It’s not using v4.3.0.

0reactions
kidrocacommented, Oct 11, 2022

We had this issue come up in unit tests

  1. We updated to React 18
  2. We’re using "@material-ui/core": "^4.12.1" (couldn’t automigrate and a lot of stuff needs to be manually checked before we switch to 5)
  3. A few tests where we use fireEvent on a button started to trigger this pulsate error

Reading @testing-library documentation it suggested:

Most projects have a few use cases for fireEvent, but the majority of the time you should probably use @testing-library/user-event.

Switching to @testing-library/user-event and user.click(button) (vs fireEvent.click(button)) fixed our tests

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'pulsate' of undefined in ButtonBase ...
[x ] I have searched the issues of this repository and believe that this is not a duplicate. Expected Behavior. No component crash....
Read more >
Cannot read properties of null (reading 'pulsate') in material-ui ...
I tried removing each prop in button and checked whether it is working or not. I found, button works without autoFocus prop.
Read more >
Cannot read properties of null (reading 'pulsate') in material-ui ...
Coding example for the question Cannot read properties of null (reading 'pulsate') in material-ui Button component-Reactjs.
Read more >
cannot read properties of null (reading '0') react - You.com
With react useRef, the first time the component renders it'll be equal to null. It gets a value assigned only once that element...
Read more >
Troubleshooting - Material UI - MUI
TypeError : Cannot read properties of undefined (reading 'pxToRem'). This error results from trying to access an empty theme. Make sure that you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found