Skip to content
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

Ignore DOM writes outside the batch in ReactPerf #6516

Merged
merged 1 commit into from
Apr 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/test/ReactDefaultPerfAnalysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
});
Expand Down
12 changes: 12 additions & 0 deletions src/test/__tests__/ReactDefaultPerf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down