Skip to content

Commit 48c7bbd

Browse files
authored
[Fiber] Nits (#8507)
Some best practices.
1 parent 2be0d93 commit 48c7bbd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/renderers/shared/fiber/ReactFiberBeginWork.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ module.exports = function<T, P, I, TI, C>(
6363
scheduleUpdate : (fiber: Fiber) => void
6464
) {
6565

66+
const { shouldSetTextContent } = config;
67+
6668
const {
6769
adoptClassInstance,
6870
constructClassInstance,
@@ -213,16 +215,16 @@ module.exports = function<T, P, I, TI, C>(
213215
function updateHostComponent(current, workInProgress) {
214216
const nextProps = workInProgress.pendingProps;
215217
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);
218220
if (isDirectTextChild) {
219221
// We special case a direct text child of a host node. This is a common
220222
// case. We won't handle it as a reified child. We will instead handle
221223
// this in the host environment that also have access to this prop. That
222224
// avoids allocating another HostText fiber and traversing it.
223225
nextChildren = null;
224226
} else if (prevProps && (
225-
config.shouldSetTextContent(prevProps) ||
227+
shouldSetTextContent(prevProps) ||
226228
prevProps.children === null ||
227229
typeof prevProps.children === 'undefined' ||
228230
typeof prevProps.children === 'boolean'
@@ -232,7 +234,7 @@ module.exports = function<T, P, I, TI, C>(
232234
workInProgress.effectTag |= ContentReset;
233235
}
234236

235-
if (workInProgress.pendingProps.hidden &&
237+
if (nextProps.hidden &&
236238
workInProgress.pendingWorkPriority !== OffscreenPriority) {
237239
// If this host component is hidden, we can bail out on the children.
238240
// We'll rerender the children later at the lower priority.

0 commit comments

Comments
 (0)