Merge pull request #6516 from gaearon/ignore-dom-writes-outside-batch
Ignore DOM writes outside the batch in ReactPerf
This commit is contained in:
commit
6a93137f0e
|
@ -175,12 +175,13 @@ function getUnchangedComponents(measurement) {
|
|||
// the amount of time it took to render the entire subtree.
|
||||
var cleanComponents = {};
|
||||
var writes = measurement.writes;
|
||||
var hierarchy = measurement.hierarchy;
|
||||
var dirtyComposites = {};
|
||||
Object.keys(writes).forEach(function(id) {
|
||||
writes[id].forEach(function(write) {
|
||||
// Root mounting (innerHTML set) is recorded with an ID of ''
|
||||
if (id !== '') {
|
||||
measurement.hierarchy[id].forEach((c) => dirtyComposites[c] = true);
|
||||
if (id !== '' && hierarchy.hasOwnProperty(id)) {
|
||||
hierarchy[id].forEach((c) => dirtyComposites[c] = true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -239,6 +239,18 @@ describe('ReactDefaultPerf', function() {
|
|||
expect(summary).toEqual([]);
|
||||
});
|
||||
|
||||
it('should not fail on input change events', function() {
|
||||
var container = document.createElement('div');
|
||||
var onChange = () => {};
|
||||
var input = ReactDOM.render(
|
||||
<input checked={true} onChange={onChange} />,
|
||||
container
|
||||
);
|
||||
expectNoWaste(() => {
|
||||
ReactTestUtils.Simulate.change(input);
|
||||
});
|
||||
});
|
||||
|
||||
it('should print a table after calling printOperations', function() {
|
||||
var container = document.createElement('div');
|
||||
var measurements = measure(() => {
|
||||
|
|
Loading…
Reference in New Issue