From 0907a49abd709308e95a93e11dde16d67c06dd43 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 21 Dec 2016 11:34:13 -0800 Subject: [PATCH] Add bailout to HostRoot This doesn't need to compare props because it doesn't use props, only state. --- src/renderers/shared/fiber/ReactFiberBeginWork.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js index f219c7066c..e43e3e6f83 100644 --- a/src/renderers/shared/fiber/ReactFiberBeginWork.js +++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js @@ -267,11 +267,18 @@ module.exports = function( 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) {