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.

componentDidMount not called in a specific case

See original GitHub issue

The lifecycle hook componentDidMount does not get called for components that return false form shouldComponentUpdate and are wrapped in a normal component

see repro: http://jsfiddle.net/2sh26um7/4/ (4.8.0) http://jsfiddle.net/48e5jdsk/2/ (5.0.0-beta5)

the beta fixes the immediate issue from 4.8.0 but if you wrap the component twice the same problem happens

click the toggle button 4 times in console you will see mount unmount unmount the expected log would be mount unmount mount unmount

if you remove the wrapper the log is correct

If there is anything I can help with please let me know

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
developitcommented, Jun 1, 2016

Yes, 5.0.0-beta6 fixes the mount event. It looks like it might duplicate the unmount event though, looking into that now.

0reactions
developitcommented, Jun 6, 2016

@kruczy + @zhenkunou - Forgot to tag the commit with this issue, but I’ve published what I hope is a proper fix for this. It fixes the repro: http://jsfiddle.net/developit/48e5jdsk/7/

Closing as hopeful for now but let me know if you have other cases/repros that are still affected!

Read more comments on GitHub >

github_iconTop Results From Across the Web

react componentDidMount not firing - Stack Overflow
I set up a new react project and for some reason, the componentDidMount method is not being called.
Read more >
React Lifecycle Methods Render And ComponentDidMount
componentDidMount () method is the perfect place, where we can call the setState() method to change the state of our application and render()...
Read more >
componentDidMount not called in a specific case #172 - GitHub
The lifecycle hook componentDidMount does not get called for components that return false form shouldComponentUpdate and are wrapped in a ...
Read more >
ReactJS componentDidMount() Method - GeeksforGeeks
The componentDidMount() method allows us to execute the React code when the component is already placed in the DOM (Document Object Model).
Read more >
Rendering and Updating Data using Component Lifecycle ...
Let's look at a use case that shows how to render something when the component is added into the rendering phase. We'll use...
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