[Fiber] Nits (#8507)

Some best practices.
This commit is contained in:
Sebastian Markbåge
2016-12-06 11:15:46 -08:00
committed by GitHub
parent 2be0d93c77
commit 48c7bbd980
@@ -63,6 +63,8 @@ module.exports = function<T, P, I, TI, C>(
scheduleUpdate : (fiber: Fiber) => void
) {
const { shouldSetTextContent } = config;
const {
adoptClassInstance,
constructClassInstance,
@@ -213,8 +215,8 @@ module.exports = function<T, P, I, TI, C>(
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<T, P, I, TI, C>(
// 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<T, P, I, TI, C>(
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.