From 48c7bbd9801d5559eb676b38e46e7f1eb19f1481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Tue, 6 Dec 2016 11:15:46 -0800 Subject: [PATCH] [Fiber] Nits (#8507) Some best practices. --- src/renderers/shared/fiber/ReactFiberBeginWork.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js index 812614dd34..d448856fd8 100644 --- a/src/renderers/shared/fiber/ReactFiberBeginWork.js +++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js @@ -63,6 +63,8 @@ module.exports = function( scheduleUpdate : (fiber: Fiber) => void ) { + const { shouldSetTextContent } = config; + const { adoptClassInstance, constructClassInstance, @@ -213,8 +215,8 @@ module.exports = function( function updateHostComponent(current, workInProgress) { const nextProps = workInProgress.pendingProps; const prevProps = current ? current.memoizedProps : null; - let nextChildren = workInProgress.pendingProps.children; - const isDirectTextChild = config.shouldSetTextContent(nextProps); + let nextChildren = nextProps.children; + const isDirectTextChild = shouldSetTextContent(nextProps); if (isDirectTextChild) { // We special case a direct text child of a host node. This is a common // case. We won't handle it as a reified child. We will instead handle @@ -222,7 +224,7 @@ module.exports = function( // avoids allocating another HostText fiber and traversing it. nextChildren = null; } else if (prevProps && ( - config.shouldSetTextContent(prevProps) || + shouldSetTextContent(prevProps) || prevProps.children === null || typeof prevProps.children === 'undefined' || typeof prevProps.children === 'boolean' @@ -232,7 +234,7 @@ module.exports = function( workInProgress.effectTag |= ContentReset; } - if (workInProgress.pendingProps.hidden && + if (nextProps.hidden && workInProgress.pendingWorkPriority !== OffscreenPriority) { // If this host component is hidden, we can bail out on the children. // We'll rerender the children later at the lower priority.