New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shouldComponentUpdate() not working on development when used with Router #2114
Comments
I'm bumping into this as well 👍 |
Can someone send me a sample repo please ? 🙏 |
Of course: https://github.com/coluccini/next-with-redux /lib/app.js // includes AppContainer which bypasses shouldComponentUpdate method
// https://github.com/gaearon/react-hot-loader/issues/442 So, I think, this is where everything starts. |
Another thing I saw is that, on Dev, the |
Hello, Even I observe this. |
This just bit us in production (and continues to be a problem) because we're not able to test shouldComponentUpdate logic effectively in development. Something that re-renders appropriately in development might very well not re-render in production. @arunoda - to add to the above example, I have created an example that reproduces the issue in an isolated environment. It includes instructions for running, and seeing what's going on. It also includes a link to an animated gif for you lazy folks out there :). |
Any info on this? The thing we're working on needs to ensure a component never gets modified (ads), and it's hard to manage this without the use of shouldComponentUpdate. |
I am also facing this same issue, I need to make sure shouldComponentUpdate is ran but this is not happening after adding |
This should be fixed by #4500, which is currently available on next@canary. |
Hi!
I'm trying to implement
shouldComponentUpdate()
method on some components to avoid unnecessaries renders and it is totally ignored while in development. The render method is triggered even if I return a straight false in it. But it works as expected in the production build...So I've dug around and it looks like when using Router to change the url (even if you stay in the same page and use shallow routing) everything gets re renders without taking shouldComponentUpdate into account. But only in development.
I've reproduced this in the with-redux example making this 2 changes to
components/AddCount.js
file:If you run this in devel the count would increase and it will stay the same on a production build.
It this the expected behaviour? is there's a way to avoid it?
PS: same think happens using PureComponent or with Recompose HOC, like pure(), shouldUpdate(), etc.
The text was updated successfully, but these errors were encountered: