-
Notifications
You must be signed in to change notification settings - Fork 50.2k
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Rendering a list of controlled checkboxes causes the reconciler to unnecessarily update (add or remove) the checked attribute on every render, regardless of whether the value has changed.
I have a table with ~300-500 rows that needs to add a "highlighted" class to the rows based on some user interaction on another part of the screen. I'd expect that the table renderer would get called on every interaction, but I was seeing ~40ms render times in the Perf tool. I dug into it and it looks like every render the reconciler removes the "checked" attribute (see JSFiddle). The checked attribute on the row datum never changes; is always false.
Extracting the rows into their own component and using componentShouldUpdate fixes the slowness, but this seems like a bug.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/reactjs/69z2wepo/).
Here are two JSFiddles demonstrating the issue:
Minimal repro: https://jsfiddle.net/69z2wepo/49455/
Full repro: https://jsfiddle.net/69z2wepo/49466/
What is the expected behavior?
The reconciler shouldn't be touching the DOM for attributes that haven't changed.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Mac OSX 10.11. Chrome 51, Safari 9.1, Firefox 44
React Version 15.0.1.