Add bailout to HostRoot

This doesn't need to compare props because it doesn't use props,
only state.
This commit is contained in:
Sebastian Markbage committed 2016-12-21 11:34:13 -08:00
1 parent 5a32fdb8e5
commit 0907a49abd
1 file changed
+8 -1
@@ -267,11 +267,18 @@ module.exports = function<T, P, I, TI, C, CX>(
if (updateQueue) {
const prevState = workInProgress.memoizedState;
const state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel);
if (prevState === state) {
// If the state is the same as before, that's a bailout because we had
// no work matching this priority.
return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
const element = state.element;
reconcileChildren(current, workInProgress, element);
workInProgress.memoizedState = state;
return workInProgress.child;
}
return workInProgress.child;
// If there is no update queue, that's a bailout because the root has no props.
return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
function updateHostComponent(current, workInProgress) {