[Fiber] Nits (#8507)
Some best practices.
Sebastian Markbåge committed
Dec 6, 2016 at 11:15 UTC
48c7bbd9801d5559eb676b38e46e7f1eb19f1481
1 file changed
+6
-4
src/renderers/shared/fiber/ReactFiberBeginWork.js
+6
-4
@@ -63,6 +63,8 @@ module.exports = function<T, P, I, TI, C>(
63
scheduleUpdate : (fiber: Fiber) => void
64
) {
65
66
+ const { shouldSetTextContent } = config;
67
+
68
const {
69
adoptClassInstance,
70
constructClassInstance,
@@ -213,8 +215,8 @@ module.exports = function<T, P, I, TI, C>(
215
function updateHostComponent(current, workInProgress) {
216
const nextProps = workInProgress.pendingProps;
217
const prevProps = current ? current.memoizedProps : null;
216
- let nextChildren = workInProgress.pendingProps.children;
217
- const isDirectTextChild = config.shouldSetTextContent(nextProps);
218
+ let nextChildren = nextProps.children;
219
+ const isDirectTextChild = shouldSetTextContent(nextProps);
220
if (isDirectTextChild) {
221
// We special case a direct text child of a host node. This is a common
222
// 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>(
224
// avoids allocating another HostText fiber and traversing it.
225
nextChildren = null;
226
} else if (prevProps && (
225
- config.shouldSetTextContent(prevProps) ||
227
+ shouldSetTextContent(prevProps) ||
228
prevProps.children === null ||
229
typeof prevProps.children === 'undefined' ||
230
typeof prevProps.children === 'boolean'
@@ -232,7 +234,7 @@ module.exports = function<T, P, I, TI, C>(
234
workInProgress.effectTag |= ContentReset;
235
}
236
235
- if (workInProgress.pendingProps.hidden &&
237
+ if (nextProps.hidden &&
238
workInProgress.pendingWorkPriority !== OffscreenPriority) {
239
// If this host component is hidden, we can bail out on the children.
240
// We'll rerender the children later at the lower priority.