Skip to content

Commit fe6760d

Browse files
committed
Don't diff memoized host components
1 parent 6e8f24d commit fe6760d

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

packages/react-reconciler/src/ReactFiberCompleteWork.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ function completeWork(
361361
// If we have an alternate, that means this is an update and we need to
362362
// schedule a side-effect to do the updates.
363363
const oldProps = current.memoizedProps;
364+
365+
if (oldProps === newProps) {
366+
break;
367+
}
368+
364369
// If we get updated because one of our children updated, we don't
365370
// have newProps so we'll have to reuse them.
366371
// TODO: Split the update API as separate for the props vs. children.

packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ exports[`ReactDebugFiberPerf deduplicates lifecycle names during commit to reduc
8585
8686
⚛ (Committing Changes)
8787
⚛ (Committing Snapshot Effects: 0 Total)
88-
⚛ (Committing Host Effects: 3 Total)
89-
⚛ (Calling Lifecycle Methods: 3 Total)
88+
⚛ (Committing Host Effects: 2 Total)
89+
⚛ (Calling Lifecycle Methods: 2 Total)
9090
⚛ B.componentDidUpdate
9191
"
9292
`;
@@ -257,8 +257,8 @@ exports[`ReactDebugFiberPerf measures deprioritized work 1`] = `
257257
258258
⚛ (Committing Changes)
259259
⚛ (Committing Snapshot Effects: 0 Total)
260-
⚛ (Committing Host Effects: 3 Total)
261-
⚛ (Calling Lifecycle Methods: 2 Total)
260+
⚛ (Committing Host Effects: 1 Total)
261+
⚛ (Calling Lifecycle Methods: 0 Total)
262262
"
263263
`;
264264

@@ -311,8 +311,8 @@ exports[`ReactDebugFiberPerf recovers from caught errors 1`] = `
311311
312312
⚛ (Committing Changes)
313313
⚛ (Committing Snapshot Effects: 0 Total)
314-
⚛ (Committing Host Effects: 2 Total)
315-
⚛ (Calling Lifecycle Methods: 1 Total)
314+
⚛ (Committing Host Effects: 1 Total)
315+
⚛ (Calling Lifecycle Methods: 0 Total)
316316
"
317317
`;
318318

@@ -357,8 +357,8 @@ exports[`ReactDebugFiberPerf skips parents during setState 1`] = `
357357
358358
⚛ (Committing Changes)
359359
⚛ (Committing Snapshot Effects: 0 Total)
360-
⚛ (Committing Host Effects: 6 Total)
361-
⚛ (Calling Lifecycle Methods: 6 Total)
360+
⚛ (Committing Host Effects: 2 Total)
361+
⚛ (Calling Lifecycle Methods: 2 Total)
362362
"
363363
`;
364364

@@ -431,8 +431,8 @@ exports[`ReactDebugFiberPerf warns on cascading renders from setState 1`] = `
431431
432432
⚛ (Committing Changes)
433433
⚛ (Committing Snapshot Effects: 0 Total)
434-
⚛ (Committing Host Effects: 2 Total)
435-
⚛ (Calling Lifecycle Methods: 2 Total)
434+
⚛ (Committing Host Effects: 1 Total)
435+
⚛ (Calling Lifecycle Methods: 1 Total)
436436
"
437437
`;
438438

0 commit comments

Comments
 (0)