diff --git a/src/renderers/shared/fiber/ReactChildFiber.js b/src/renderers/shared/fiber/ReactChildFiber.js index ceb7dc345bb..79f80c9e408 100644 --- a/src/renderers/shared/fiber/ReactChildFiber.js +++ b/src/renderers/shared/fiber/ReactChildFiber.js @@ -73,9 +73,9 @@ const { Deletion, } = ReactTypeOfSideEffect; -function coerceRef(current: ?Fiber, element: ReactElement) { +function coerceRef(current: Fiber | null, element: ReactElement) { let mixedRef = element.ref; - if (mixedRef != null && typeof mixedRef !== 'function') { + if (mixedRef !== null && typeof mixedRef !== 'function') { if (element._owner) { const owner : ?(Fiber | ReactInstance) = (element._owner : any); let inst; @@ -97,7 +97,7 @@ function coerceRef(current: ?Fiber, element: ReactElement) { ); const stringRef = String(mixedRef); // Check if previous string ref matches new string ref - if (current && current.ref && current.ref._stringRef === stringRef) { + if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) { return current.ref; } const ref = function(value) { @@ -161,14 +161,14 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { // When we're reconciling in place we have a work in progress copy. We // actually want the current copy. If there is no current copy, then we // don't need to track deletion side-effects. - if (!childToDelete.alternate) { + if (childToDelete.alternate === null) { return; } childToDelete = childToDelete.alternate; } // Deletions are added in reversed order so we add it to the front. const last = returnFiber.progressedLastDeletion; - if (last) { + if (last !== null) { last.nextEffect = childToDelete; returnFiber.progressedLastDeletion = childToDelete; } else { @@ -182,7 +182,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function deleteRemainingChildren( returnFiber : Fiber, - currentFirstChild : ?Fiber + currentFirstChild : Fiber | null ) : null { if (!shouldTrackSideEffects) { // Noop. @@ -192,7 +192,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { // TODO: For the shouldClone case, this could be micro-optimized a bit by // assuming that after the first child we've already added everything. let childToDelete = currentFirstChild; - while (childToDelete) { + while (childToDelete !== null) { deleteChild(returnFiber, childToDelete); childToDelete = childToDelete.sibling; } @@ -209,7 +209,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { const existingChildren : Map = new Map(); let existingChild = currentFirstChild; - while (existingChild) { + while (existingChild !== null) { if (existingChild.key !== null) { existingChildren.set(existingChild.key, existingChild); } else { @@ -247,7 +247,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { return lastPlacedIndex; } const current = newFiber.alternate; - if (current) { + if (current !== null) { const oldIndex = current.index; if (oldIndex < lastPlacedIndex) { // This is a move. @@ -267,7 +267,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function placeSingleChild(newFiber : Fiber) : Fiber { // This is simpler for the single child case. We only need to do a // placement for inserting new children. - if (shouldTrackSideEffects && !newFiber.alternate) { + if (shouldTrackSideEffects && newFiber.alternate === null) { newFiber.effectTag = Placement; } return newFiber; @@ -275,11 +275,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateTextNode( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, textContent : string, priority : PriorityLevel ) { - if (current == null || current.tag !== HostText) { + if (current === null || current.tag !== HostText) { // Insert const created = createFiberFromText(textContent, priority); created.return = returnFiber; @@ -295,11 +295,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateElement( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, element : ReactElement, priority : PriorityLevel ) : Fiber { - if (current == null || current.type !== element.type) { + if (current === null || current.type !== element.type) { // Insert const created = createFiberFromElement(element, priority); created.ref = coerceRef(current, element); @@ -321,12 +321,12 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateCoroutine( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, coroutine : ReactCoroutine, priority : PriorityLevel ) : Fiber { // TODO: Should this also compare handler to determine whether to reuse? - if (current == null || current.tag !== CoroutineComponent) { + if (current === null || current.tag !== CoroutineComponent) { // Insert const created = createFiberFromCoroutine(coroutine, priority); created.return = returnFiber; @@ -342,11 +342,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateYield( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, yieldNode : ReactYield, priority : PriorityLevel ) : Fiber { - if (current == null || current.tag !== YieldComponent) { + if (current === null || current.tag !== YieldComponent) { // Insert const created = createFiberFromYield(yieldNode, priority); created.type = yieldNode.value; @@ -363,12 +363,12 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updatePortal( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, portal : ReactPortal, priority : PriorityLevel ) : Fiber { if ( - current == null || + current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation @@ -388,11 +388,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateFragment( returnFiber : Fiber, - current : ?Fiber, + current : Fiber | null, fragment : Iterable<*>, priority : PriorityLevel ) : Fiber { - if (current == null || current.tag !== Fragment) { + if (current === null || current.tag !== Fragment) { // Insert const created = createFiberFromFragment(fragment, priority); created.return = returnFiber; @@ -410,7 +410,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { returnFiber : Fiber, newChild : any, priority : PriorityLevel - ) : ?Fiber { + ) : Fiber | null { if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes doesn't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text @@ -463,13 +463,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function updateSlot( returnFiber : Fiber, - oldFiber : ?Fiber, + oldFiber : Fiber | null, newChild : any, priority : PriorityLevel - ) : ?Fiber { + ) : Fiber | null { // Update the fiber if the keys match, otherwise return null. - const key = oldFiber ? oldFiber.key : null; + const key = oldFiber !== null ? oldFiber.key : null; if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes doesn't have keys. If the previous node is implicitly keyed @@ -540,7 +540,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { newIdx : number, newChild : any, priority : PriorityLevel - ) : ?Fiber { + ) : Fiber | null { if (typeof newChild === 'string' || typeof newChild === 'number') { // Text nodes doesn't have keys, so we neither have to check the old nor @@ -596,7 +596,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { knownKeys : Set | null ) : Set | null { if (__DEV__) { - if (typeof child !== 'object' || child == null) { + if (typeof child !== 'object' || child === null) { return knownKeys; } switch (child.$$typeof) { @@ -607,7 +607,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { if (typeof key !== 'string') { break; } - if (knownKeys == null) { + if (knownKeys === null) { knownKeys = new Set(); knownKeys.add(key); break; @@ -634,9 +634,9 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileChildrenArray( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, newChildren : Array<*>, - priority : PriorityLevel) : ?Fiber { + priority : PriorityLevel) : Fiber | null { // This algorithm can't optimize by searching from boths ends since we // don't have backpointers on fibers. I'm trying to see how far we can get @@ -666,21 +666,19 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { } } - let resultingFirstChild : ?Fiber = null; - let previousNewFiber : ?Fiber = null; + let resultingFirstChild : Fiber | null = null; + let previousNewFiber : Fiber | null = null; let oldFiber = currentFirstChild; let lastPlacedIndex = 0; let newIdx = 0; let nextOldFiber = null; - for (; oldFiber && newIdx < newChildren.length; newIdx++) { - if (oldFiber) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } + for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; } const newFiber = updateSlot( returnFiber, @@ -688,25 +686,25 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { newChildren[newIdx], priority ); - if (!newFiber) { + if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, // boolean, undefined, etc. - if (!oldFiber) { + if (oldFiber === null) { oldFiber = nextOldFiber; } break; } if (shouldTrackSideEffects) { - if (oldFiber && !newFiber.alternate) { + if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { @@ -726,7 +724,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { return resultingFirstChild; } - if (!oldFiber) { + if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; newIdx < newChildren.length; newIdx++) { @@ -739,7 +737,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { continue; } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { @@ -764,7 +762,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { ); if (newFiber) { if (shouldTrackSideEffects) { - if (newFiber.alternate) { + if (newFiber.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion @@ -775,7 +773,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { resultingFirstChild = newFiber; } else { previousNewFiber.sibling = newFiber; @@ -795,9 +793,9 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileChildrenIterator( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, newChildrenIterable : Iterable<*>, - priority : PriorityLevel) : ?Fiber { + priority : PriorityLevel) : Fiber | null { // This is the same implementation as reconcileChildrenArray(), // but using the iterator instead. @@ -852,8 +850,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { 'An iterable object provided no iterator.', ); - let resultingFirstChild : ?Fiber = null; - let previousNewFiber : ?Fiber = null; + let resultingFirstChild : Fiber | null = null; + let previousNewFiber : Fiber | null = null; let oldFiber = currentFirstChild; let lastPlacedIndex = 0; @@ -861,14 +859,12 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { let nextOldFiber = null; let step = newChildren.next(); - for (; oldFiber && !step.done; newIdx++, step = newChildren.next()) { - if (oldFiber) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } + for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else { + nextOldFiber = oldFiber.sibling; } const newFiber = updateSlot( returnFiber, @@ -876,7 +872,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { step.value, priority ); - if (!newFiber) { + if (newFiber === null) { // TODO: This breaks on empty slots like null children. That's // unfortunate because it triggers the slow path all the time. We need // a better way to communicate whether this was a miss or null, @@ -887,14 +883,14 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { break; } if (shouldTrackSideEffects) { - if (oldFiber && !newFiber.alternate) { + if (oldFiber && newFiber.alternate === null) { // We matched the slot, but we didn't reuse the existing fiber, so we // need to delete the existing child. deleteChild(returnFiber, oldFiber); } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { @@ -914,7 +910,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { return resultingFirstChild; } - if (!oldFiber) { + if (oldFiber === null) { // If we don't have any more existing children we can choose a fast path // since the rest will all be insertions. for (; !step.done; newIdx++, step = newChildren.next()) { @@ -923,11 +919,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { step.value, priority ); - if (!newFiber) { + if (newFiber === null) { continue; } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { // TODO: Move out of the loop. This only happens for the first run. resultingFirstChild = newFiber; } else { @@ -950,9 +946,9 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { step.value, priority ); - if (newFiber) { + if (newFiber !== null) { if (shouldTrackSideEffects) { - if (newFiber.alternate) { + if (newFiber.alternate !== null) { // The new fiber is a work in progress, but if there exists a // current, that means that we reused the fiber. We need to delete // it from the child list so that we don't add it to the deletion @@ -963,7 +959,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { } } lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - if (!previousNewFiber) { + if (previousNewFiber === null) { resultingFirstChild = newFiber; } else { previousNewFiber.sibling = newFiber; @@ -983,13 +979,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileSingleTextNode( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, textContent : string, priority : PriorityLevel ) : Fiber { // There's no need to check for keys on text nodes since we don't have a // way to define them. - if (currentFirstChild && currentFirstChild.tag === HostText) { + if (currentFirstChild !== null && currentFirstChild.tag === HostText) { // We already have an existing node so let's just update it and delete // the rest. deleteRemainingChildren(returnFiber, currentFirstChild.sibling); @@ -1008,13 +1004,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileSingleElement( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, element : ReactElement, priority : PriorityLevel ) : Fiber { const key = element.key; let child = currentFirstChild; - while (child) { + while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { @@ -1047,13 +1043,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileSingleCoroutine( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, coroutine : ReactCoroutine, priority : PriorityLevel ) : Fiber { const key = coroutine.key; let child = currentFirstChild; - while (child) { + while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { @@ -1080,13 +1076,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileSingleYield( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, yieldNode : ReactYield, priority : PriorityLevel ) : Fiber { // There's no need to check for keys on yields since they're stateless. let child = currentFirstChild; - if (child) { + if (child !== null) { if (child.tag === YieldComponent) { deleteRemainingChildren(returnFiber, child.sibling); const existing = useFiber(child, priority); @@ -1106,13 +1102,13 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { function reconcileSinglePortal( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, portal : ReactPortal, priority : PriorityLevel ) : Fiber { const key = portal.key; let child = currentFirstChild; - while (child) { + while (child !== null) { // TODO: If key === null and child.key === null, then this only applies to // the first item in the list. if (child.key === key) { @@ -1146,10 +1142,10 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { // children and the parent. function reconcileChildFibers( returnFiber : Fiber, - currentFirstChild : ?Fiber, + currentFirstChild : Fiber | null, newChild : any, priority : PriorityLevel - ) : ?Fiber { + ) : Fiber | null { // This function is not recursive. // If the top level item is an array, we treat it as a set of children, // not as a fragment. Nested arrays on the other hand will be treated as @@ -1329,11 +1325,11 @@ exports.reconcileChildFibersInPlace = ChildReconciler(false, true); exports.mountChildFibersInPlace = ChildReconciler(false, false); -exports.cloneChildFibers = function(current : ?Fiber, workInProgress : Fiber) : void { +exports.cloneChildFibers = function(current : Fiber | null, workInProgress : Fiber) : void { if (!workInProgress.child) { return; } - if (current && workInProgress.child === current.child) { + if (current !== null && workInProgress.child === current.child) { // We use workInProgress.child since that lets Flow know that it can't be // null since we validated that already. However, as the line above suggests // they're actually the same thing. @@ -1349,7 +1345,7 @@ exports.cloneChildFibers = function(current : ?Fiber, workInProgress : Fiber) : workInProgress.child = newChild; newChild.return = workInProgress; - while (currentChild.sibling) { + while (currentChild.sibling !== null) { currentChild = currentChild.sibling; newChild = newChild.sibling = cloneFiber( currentChild, @@ -1365,7 +1361,7 @@ exports.cloneChildFibers = function(current : ?Fiber, workInProgress : Fiber) : // need to clone. We need to reset the return fiber though since we'll // traverse down into them. let child = workInProgress.child; - while (child) { + while (child !== null) { child.return = workInProgress; child = child.sibling; } diff --git a/src/renderers/shared/fiber/ReactDebugCurrentFiber.js b/src/renderers/shared/fiber/ReactDebugCurrentFiber.js index c1ce29ea1c4..d857e5f2dd3 100644 --- a/src/renderers/shared/fiber/ReactDebugCurrentFiber.js +++ b/src/renderers/shared/fiber/ReactDebugCurrentFiber.js @@ -22,7 +22,7 @@ if (__DEV__) { function getCurrentFiberOwnerName() : string | null { if (__DEV__) { const fiber = ReactDebugCurrentFiber.current; - if (fiber == null) { + if (fiber === null) { return null; } if (fiber._debugOwner != null) { @@ -35,7 +35,7 @@ function getCurrentFiberOwnerName() : string | null { function getCurrentFiberStackAddendum() : string | null { if (__DEV__) { const fiber = ReactDebugCurrentFiber.current; - if (fiber == null) { + if (fiber === null) { return null; } // Safe because if current fiber exists, we are reconciling, diff --git a/src/renderers/shared/fiber/ReactFiber.js b/src/renderers/shared/fiber/ReactFiber.js index 6af37269e75..d7ecf743711 100644 --- a/src/renderers/shared/fiber/ReactFiber.js +++ b/src/renderers/shared/fiber/ReactFiber.js @@ -93,11 +93,11 @@ export type Fiber = { // This is effectively the parent, but there can be multiple parents (two) // so this is only the parent of the thing we're currently processing. // It is conceptually the same as the return address of a stack frame. - return: ?Fiber, + return: Fiber | null, // Singly Linked List Tree Structure. - child: ?Fiber, - sibling: ?Fiber, + child: Fiber | null, + sibling: Fiber | null, index: number, // The ref last used to attach this node. @@ -119,13 +119,13 @@ export type Fiber = { effectTag: TypeOfSideEffect, // Singly linked list fast path to the next fiber with side-effects. - nextEffect: ?Fiber, + nextEffect: Fiber | null, // The first and last fiber with side-effect within this subtree. This allows // us to reuse a slice of the linked list when we reuse the work done within // this fiber. - firstEffect: ?Fiber, - lastEffect: ?Fiber, + firstEffect: Fiber | null, + lastEffect: Fiber | null, // This will be used to quickly determine if a subtree has no pending changes. pendingWorkPriority: PriorityLevel, @@ -139,19 +139,19 @@ export type Fiber = { // priority, then we need to store the progressed work somewhere. This holds // the started child set until we need to get back to working on it. It may // or may not be the same as the "current" child. - progressedChild: ?Fiber, + progressedChild: Fiber | null, // When we reconcile children onto progressedChild it is possible that we have // to delete some child fibers. We need to keep track of this side-effects so // that if we continue later on, we have to include those effects. Deletions // are added in the reverse order from sibling pointers. - progressedFirstDeletion: ?Fiber, - progressedLastDeletion: ?Fiber, + progressedFirstDeletion: Fiber | null, + progressedLastDeletion: Fiber | null, // This is a pooled version of a Fiber. Every fiber that gets updated will // eventually have a pair. There are cases when we can clean up pairs to save // memory if we need to. - alternate: ?Fiber, + alternate: Fiber | null, // Conceptual aliases // workInProgress : Fiber -> alternate The alternate used for reuse happens @@ -249,7 +249,7 @@ exports.cloneFiber = function(fiber : Fiber, priorityLevel : PriorityLevel) : Fi // objects for things that are never updated. It also allow us to reclaim the // extra memory if needed. let alt = fiber.alternate; - if (alt) { + if (alt !== null) { // If we clone, then we do so from the "current" state. The current state // can't have any side-effects that are still valid so we reset just to be // sure. diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js index 947ba6ed24e..ffe68983d4d 100644 --- a/src/renderers/shared/fiber/ReactFiberBeginWork.js +++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js @@ -102,7 +102,7 @@ module.exports = function( // We now have clones. Let's store them as the currently progressed work. workInProgress.progressedChild = workInProgress.child; workInProgress.progressedPriority = priorityLevel; - if (current) { + if (current !== null) { // We also store it on the current. When the alternate swaps in we can // continue from this point. current.progressedChild = workInProgress.progressedChild; @@ -131,7 +131,7 @@ module.exports = function( // At this point any memoization is no longer valid since we'll have changed // the children. workInProgress.memoizedProps = null; - if (!current) { + if (current === null) { // If this is a fresh new component that hasn't been rendered yet, we // won't update its child set by applying minimal side-effects. Instead, // we will add them all to the child before it gets rendered. That means @@ -191,9 +191,9 @@ module.exports = function( return workInProgress.child; } - function markRef(current : ?Fiber, workInProgress : Fiber) { + function markRef(current : Fiber | null, workInProgress : Fiber) { const ref = workInProgress.ref; - if (ref && (!current || current.ref !== ref)) { + if (ref !== null && (!current || current.ref !== ref)) { // Schedule a Ref effect workInProgress.effectTag |= Ref; } @@ -211,7 +211,7 @@ module.exports = function( nextProps = memoizedProps; } } else { - if (nextProps == null || memoizedProps === nextProps) { + if (nextProps === null || memoizedProps === nextProps) { return bailoutOnAlreadyFinishedWork(current, workInProgress); } // TODO: Disable this before release, since it is not part of the public API @@ -240,14 +240,14 @@ module.exports = function( return workInProgress.child; } - function updateClassComponent(current : ?Fiber, workInProgress : Fiber, priorityLevel : PriorityLevel) { + function updateClassComponent(current : Fiber | null, workInProgress : Fiber, priorityLevel : PriorityLevel) { // Push context providers early to prevent context stack mismatches. // During mounting we don't know the child context yet as the instance doesn't exist. // We will invalidate the child context in finishClassComponent() right after rendering. const hasContext = pushContextProvider(workInProgress); let shouldUpdate; - if (!current) { + if (current === null) { if (!workInProgress.stateNode) { // In the initial pass we might need to construct the instance. constructClassInstance(workInProgress); @@ -264,7 +264,7 @@ module.exports = function( } function finishClassComponent( - current : ?Fiber, + current : Fiber | null, workInProgress : Fiber, shouldUpdate : boolean, hasContext : boolean, @@ -314,7 +314,7 @@ module.exports = function( pushHostContainer(workInProgress, root.containerInfo); const updateQueue = workInProgress.updateQueue; - if (updateQueue) { + if (updateQueue !== null) { const prevState = workInProgress.memoizedState; const state = beginUpdateQueue(workInProgress, updateQueue, null, prevState, null, priorityLevel); if (prevState === state) { @@ -335,7 +335,7 @@ module.exports = function( pushHostContext(workInProgress); let nextProps = workInProgress.pendingProps; - const prevProps = current ? current.memoizedProps : null; + const prevProps = current !== null ? current.memoizedProps : null; const memoizedProps = workInProgress.memoizedProps; if (hasContextChanged()) { // Normally we can bail out on props equality but if context has changed @@ -359,7 +359,7 @@ module.exports = function( // that is a bit tricky since workInProgress and current can have // different "hidden" settings. let child = workInProgress.progressedChild; - while (child) { + while (child !== null) { // To ensure that this subtree gets its priority reset, the children // need to be reset. child.pendingWorkPriority = OffscreenPriority; @@ -409,16 +409,16 @@ module.exports = function( // Reconcile the children and stash them for later work. reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority); memoizeProps(workInProgress, nextProps); - workInProgress.child = current ? current.child : null; + workInProgress.child = current !== null ? current.child : null; - if (!current) { + if (current === null) { // If this doesn't have a current we won't track it for placement // effects. However, when we come back around to this we have already // inserted the parent which means that we'll infact need to make this a // placement. // TODO: There has to be a better solution to this problem. let child = workInProgress.progressedChild; - while (child) { + while (child !== null) { child.effectTag = Placement; child = child.sibling; } @@ -464,7 +464,7 @@ module.exports = function( value = fn(props, context); } - if (typeof value === 'object' && value && typeof value.render === 'function') { + if (typeof value === 'object' && value !== null && typeof value.render === 'function') { // Proceed under the assumption that this is a class instance workInProgress.tag = ClassComponent; @@ -479,7 +479,7 @@ module.exports = function( // Proceed under the assumption that this is a functional component workInProgress.tag = FunctionalComponent; if (__DEV__) { - if (workInProgress.ref != null) { + if (workInProgress.ref !== null) { let info = ''; const ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName(); if (ownerName) { @@ -517,7 +517,7 @@ module.exports = function( if (nextCoroutine === null) { nextCoroutine = current && current.memoizedProps; invariant( - nextCoroutine != null, + nextCoroutine !== null, 'We should always have pending or current props. This error is ' + 'likely caused by a bug in React. Please file an issue.' ); @@ -538,7 +538,7 @@ module.exports = function( // At this point any memoization is no longer valid since we'll have changed // the children. workInProgress.memoizedProps = null; - if (!current) { + if (current === null) { workInProgress.stateNode = mountChildFibersInPlace( workInProgress, workInProgress.stateNode, @@ -592,7 +592,7 @@ module.exports = function( return bailoutOnAlreadyFinishedWork(current, workInProgress); } - if (!current) { + if (current === null) { // Portals are special because we don't append the children during mount // but at commit. Therefore we need to track insertions which the normal // flow doesn't do during mount. This doesn't happen at the root because @@ -632,7 +632,7 @@ module.exports = function( } */ - function bailoutOnAlreadyFinishedWork(current, workInProgress : Fiber) : ?Fiber { + function bailoutOnAlreadyFinishedWork(current, workInProgress : Fiber) : Fiber | null { const priorityLevel = workInProgress.pendingWorkPriority; // TODO: We should ideally be able to bail out early if the children have no // more work to do. However, since we don't have a separation of this @@ -687,7 +687,7 @@ module.exports = function( // is handled by beginUpdateQueue. } - function beginWork(current : ?Fiber, workInProgress : Fiber, priorityLevel : PriorityLevel) : ?Fiber { + function beginWork(current : Fiber | null, workInProgress : Fiber, priorityLevel : PriorityLevel) : Fiber | null { if (workInProgress.pendingWorkPriority === NoWork || workInProgress.pendingWorkPriority > priorityLevel) { return bailoutOnLowPriority(current, workInProgress); @@ -744,7 +744,7 @@ module.exports = function( } } - function beginFailedWork(current : ?Fiber, workInProgress : Fiber, priorityLevel : PriorityLevel) { + function beginFailedWork(current : Fiber | null, workInProgress : Fiber, priorityLevel : PriorityLevel) { invariant( workInProgress.tag === ClassComponent || workInProgress.tag === HostRoot, diff --git a/src/renderers/shared/fiber/ReactFiberClassComponent.js b/src/renderers/shared/fiber/ReactFiberClassComponent.js index d135b23531c..94fbf67c21f 100644 --- a/src/renderers/shared/fiber/ReactFiberClassComponent.js +++ b/src/renderers/shared/fiber/ReactFiberClassComponent.js @@ -71,7 +71,7 @@ module.exports = function( }; function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) { - if (oldProps === null || (workInProgress.updateQueue && workInProgress.updateQueue.hasForceUpdate)) { + if (oldProps === null || (workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) { // If the workInProgress already has an Update effect, return true return true; } @@ -208,10 +208,10 @@ module.exports = function( workInProgress.effectTag |= Update; } - function markUpdateIfAlreadyInProgress(current: ?Fiber, workInProgress : Fiber) { + function markUpdateIfAlreadyInProgress(current: Fiber | null, workInProgress : Fiber) { // If an update was already in progress, we should schedule an Update // effect even though we're bailing out, so that cWU/cDU are called. - if (current) { + if (current !== null) { if (workInProgress.memoizedProps !== current.memoizedProps || workInProgress.memoizedState !== current.memoizedState) { markUpdate(workInProgress); @@ -274,7 +274,7 @@ module.exports = function( // If we had additional state updates during this life-cycle, let's // process them now. const updateQueue = workInProgress.updateQueue; - if (updateQueue) { + if (updateQueue !== null) { instance.state = beginUpdateQueue( workInProgress, updateQueue, @@ -343,7 +343,7 @@ module.exports = function( // They may be from componentWillMount() or from error boundary's setState() // during initial mounting. const newUpdateQueue = workInProgress.updateQueue; - if (newUpdateQueue) { + if (newUpdateQueue !== null) { newInstance.state = beginUpdateQueue( workInProgress, newUpdateQueue, @@ -392,7 +392,7 @@ module.exports = function( const oldState = workInProgress.memoizedState; // TODO: Previous state can be null. let newState; - if (updateQueue) { + if (updateQueue !== null) { newState = beginUpdateQueue( workInProgress, updateQueue, @@ -408,7 +408,7 @@ module.exports = function( if (oldProps === newProps && oldState === newState && !hasContextChanged() && - !(updateQueue && updateQueue.hasForceUpdate)) { + !(updateQueue !== null && updateQueue.hasForceUpdate)) { markUpdateIfAlreadyInProgress(current, workInProgress); return false; } diff --git a/src/renderers/shared/fiber/ReactFiberCommitWork.js b/src/renderers/shared/fiber/ReactFiberCommitWork.js index 072c482355a..f1a9dffec57 100644 --- a/src/renderers/shared/fiber/ReactFiberCommitWork.js +++ b/src/renderers/shared/fiber/ReactFiberCommitWork.js @@ -38,7 +38,7 @@ var invariant = require('invariant'); module.exports = function( config : HostConfig, - captureError : (failedFiber : Fiber, error: Error) => ?Fiber + captureError : (failedFiber : Fiber, error: Error) => Fiber | null ) { const { @@ -65,7 +65,7 @@ module.exports = function( function safelyDetachRef(current : Fiber) { try { const ref = current.ref; - if (ref) { + if (ref !== null) { ref(null); } } catch (error) { @@ -74,10 +74,10 @@ module.exports = function( } // Only called during update. It's ok to throw. - function detachRefIfNeeded(current : ?Fiber, finishedWork : Fiber) { + function detachRefIfNeeded(current : Fiber | null, finishedWork : Fiber) { if (current) { const currentRef = current.ref; - if (currentRef && currentRef !== finishedWork.ref) { + if (currentRef !== null && currentRef !== finishedWork.ref) { currentRef(null); } } @@ -85,7 +85,7 @@ module.exports = function( function getHostParent(fiber : Fiber) : I | C { let parent = fiber.return; - while (parent) { + while (parent !== null) { switch (parent.tag) { case HostComponent: return parent.stateNode; @@ -105,7 +105,7 @@ module.exports = function( function getHostParentFiber(fiber : Fiber) : Fiber { let parent = fiber.return; - while (parent) { + while (parent !== null) { if (isHostParent(parent)) { return parent; } @@ -134,8 +134,8 @@ module.exports = function( let node : Fiber = fiber; siblings: while (true) { // If we didn't find anything, let's try the next sibling. - while (!node.sibling) { - if (!node.return || isHostParent(node.return)) { + while (node.sibling === null) { + if (node.return === null || isHostParent(node.return)) { // If we pop out of the root or hit the parent the fiber we are the // last sibling. return null; @@ -153,7 +153,7 @@ module.exports = function( } // If we don't have a child, try the siblings instead. // We also skip portals because they are not part of this host tree. - if (!node.child || node.tag === HostPortal) { + if (node.child === null || node.tag === HostPortal) { continue siblings; } else { node.child.return = node; @@ -211,7 +211,7 @@ module.exports = function( // If the insertion itself is a portal, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in // the portal directly. - } else if (node.child) { + } else if (node.child !== null) { node.child.return = node; node = node.child; continue; @@ -219,8 +219,8 @@ module.exports = function( if (node === finishedWork) { return; } - while (!node.sibling) { - if (!node.return || node.return === finishedWork) { + while (node.sibling === null) { + if (node.return === null || node.return === finishedWork) { return; } node = node.return; @@ -241,7 +241,7 @@ module.exports = function( commitUnmount(node); // Visit children because they may contain more composite or host nodes. // Skip portals because commitUnmount() currently visits them recursively. - if (node.child && node.tag !== HostPortal) { + if (node.child !== null && node.tag !== HostPortal) { node.child.return = node; node = node.child; continue; @@ -249,8 +249,8 @@ module.exports = function( if (node === root) { return; } - while (!node.sibling) { - if (!node.return || node.return === root) { + while (node.sibling === null) { + if (node.return === null || node.return === root) { return; } node = node.return; @@ -276,7 +276,7 @@ module.exports = function( // We will reassign it back when we pop the portal on the way up. parent = node.stateNode.containerInfo; // Visit children because portals might contain host components. - if (node.child) { + if (node.child !== null) { node.child.return = node; node = node.child; continue; @@ -284,7 +284,7 @@ module.exports = function( } else { commitUnmount(node); // Visit children because we may find more host components below. - if (node.child) { + if (node.child !== null) { node.child.return = node; node = node.child; continue; @@ -293,8 +293,8 @@ module.exports = function( if (node === current) { return; } - while (!node.sibling) { - if (!node.return || node.return === current) { + while (node.sibling === null) { + if (node.return === null || node.return === current) { return; } node = node.return; @@ -364,7 +364,7 @@ module.exports = function( } } - function commitWork(current : ?Fiber, finishedWork : Fiber) : void { + function commitWork(current : Fiber | null, finishedWork : Fiber) : void { switch (finishedWork.tag) { case ClassComponent: { detachRefIfNeeded(current, finishedWork); @@ -372,7 +372,7 @@ module.exports = function( } case HostComponent: { const instance : I = finishedWork.stateNode; - if (instance != null && current) { + if (instance != null && current !== null) { // Commit the work prepared earlier. const newProps = finishedWork.memoizedProps; const oldProps = current.memoizedProps; @@ -380,7 +380,7 @@ module.exports = function( // TODO: Type the updateQueue to be specific to host components. const updatePayload : null | PL = (finishedWork.updateQueue : any); finishedWork.updateQueue = null; - if (updatePayload) { + if (updatePayload !== null) { commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork); } } @@ -389,7 +389,7 @@ module.exports = function( } case HostText: { invariant( - finishedWork.stateNode !== null && current != null, + finishedWork.stateNode !== null && current !== null, 'This should only be done during updates. This error is likely ' + 'caused by a bug in React. Please file an issue.' ); @@ -415,12 +415,12 @@ module.exports = function( } } - function commitLifeCycles(current : ?Fiber, finishedWork : Fiber) : void { + function commitLifeCycles(current : Fiber | null, finishedWork : Fiber) : void { switch (finishedWork.tag) { case ClassComponent: { const instance = finishedWork.stateNode; if (finishedWork.effectTag & Update) { - if (!current) { + if (current === null) { if (typeof instance.componentDidMount === 'function') { instance.componentDidMount(); } @@ -432,14 +432,14 @@ module.exports = function( } } } - if ((finishedWork.effectTag & Callback) && finishedWork.updateQueue) { + if ((finishedWork.effectTag & Callback) && finishedWork.updateQueue !== null) { commitCallbacks(finishedWork, finishedWork.updateQueue, instance); } return; } case HostRoot: { const updateQueue = finishedWork.updateQueue; - if (updateQueue) { + if (updateQueue !== null) { const instance = finishedWork.child && finishedWork.child.stateNode; commitCallbacks(finishedWork, updateQueue, instance); } @@ -453,7 +453,7 @@ module.exports = function( // These effects should only be committed when components are first mounted, // aka when there is no current/alternate. if ( - !current && + current === null && finishedWork.effectTag & Update ) { const type = finishedWork.type; @@ -486,7 +486,7 @@ module.exports = function( return; } const ref = finishedWork.ref; - if (ref) { + if (ref !== null) { const instance = getPublicInstance(finishedWork.stateNode); ref(instance); } diff --git a/src/renderers/shared/fiber/ReactFiberCompleteWork.js b/src/renderers/shared/fiber/ReactFiberCompleteWork.js index a8c8137f9a5..c8a8888d605 100644 --- a/src/renderers/shared/fiber/ReactFiberCompleteWork.js +++ b/src/renderers/shared/fiber/ReactFiberCompleteWork.js @@ -71,7 +71,7 @@ module.exports = function( // We now have clones. Let's store them as the currently progressed work. workInProgress.progressedChild = workInProgress.child; workInProgress.progressedPriority = priorityLevel; - if (current) { + if (current !== null) { // We also store it on the current. When the alternate swaps in we can // continue from this point. current.progressedChild = workInProgress.progressedChild; @@ -90,7 +90,7 @@ module.exports = function( if (node) { node.return = workInProgress; } - while (node) { + while (node !== null) { if (node.tag === HostComponent || node.tag === HostText || node.tag === HostPortal) { invariant( @@ -99,13 +99,13 @@ module.exports = function( ); } else if (node.tag === YieldComponent) { yields.push(node.type); - } else if (node.child) { + } else if (node.child !== null) { node.child.return = node; node = node.child; continue; } - while (!node.sibling) { - if (!node.return || node.return === workInProgress) { + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { return; } node = node.return; @@ -115,7 +115,7 @@ module.exports = function( } } - function moveCoroutineToHandlerPhase(current : ?Fiber, workInProgress : Fiber) { + function moveCoroutineToHandlerPhase(current : Fiber | null, workInProgress : Fiber) { var coroutine = (workInProgress.memoizedProps : ?ReactCoroutine); invariant( coroutine, @@ -140,7 +140,7 @@ module.exports = function( var props = coroutine.props; var nextChildren = fn(props, yields); - var currentFirstChild = current ? current.child : null; + var currentFirstChild = current !== null ? current.child : null; // Inherit the priority of the returnFiber. const priority = workInProgress.pendingWorkPriority; workInProgress.child = reconcileChildFibers( @@ -157,22 +157,22 @@ module.exports = function( // We only have the top Fiber that was created but we need recurse down its // children to find all the terminal nodes. let node = workInProgress.child; - while (node) { + while (node !== null) { if (node.tag === HostComponent || node.tag === HostText) { appendInitialChild(parent, node.stateNode); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse // down its children. Instead, we'll get insertions from each child in // the portal directly. - } else if (node.child) { + } else if (node.child !== null) { node = node.child; continue; } if (node === workInProgress) { return; } - while (!node.sibling) { - if (!node.return || node.return === workInProgress) { + while (node.sibling === null) { + if (node.return === null || node.return === workInProgress) { return; } node = node.return; @@ -181,7 +181,7 @@ module.exports = function( } } - function completeWork(current : ?Fiber, workInProgress : Fiber) : ?Fiber { + function completeWork(current : Fiber | null, workInProgress : Fiber) : Fiber | null { if (__DEV__) { ReactDebugCurrentFiber.current = workInProgress; } @@ -208,7 +208,7 @@ module.exports = function( const rootContainerInstance = getRootHostContainer(); const type = workInProgress.type; const newProps = workInProgress.memoizedProps; - if (current && workInProgress.stateNode != null) { + if (current !== null && workInProgress.stateNode != null) { // If we have an alternate, that means this is an update and we need to // schedule a side-effect to do the updates. const oldProps = current.memoizedProps; @@ -268,7 +268,7 @@ module.exports = function( } workInProgress.stateNode = instance; - if (workInProgress.ref) { + if (workInProgress.ref !== null) { // If there is a ref on a host node we need to schedule a callback workInProgress.effectTag |= Ref; } diff --git a/src/renderers/shared/fiber/ReactFiberContext.js b/src/renderers/shared/fiber/ReactFiberContext.js index 322affe797d..8b7383458b2 100644 --- a/src/renderers/shared/fiber/ReactFiberContext.js +++ b/src/renderers/shared/fiber/ReactFiberContext.js @@ -149,7 +149,7 @@ function processChildContext(fiber : Fiber, parentContext : Object, isReconcilin if (typeof instance.getChildContext !== 'function') { if (__DEV__) { const componentName = getComponentName(fiber); - + if (!warnedAboutMissingGetChildContext[componentName]) { warnedAboutMissingGetChildContext[componentName] = true; warning( diff --git a/src/renderers/shared/fiber/ReactFiberHostContext.js b/src/renderers/shared/fiber/ReactFiberHostContext.js index 8abbc538d74..86c130c7cdd 100644 --- a/src/renderers/shared/fiber/ReactFiberHostContext.js +++ b/src/renderers/shared/fiber/ReactFiberHostContext.js @@ -44,14 +44,14 @@ module.exports = function( getRootHostContext, } = config; - let contextStackCursor : StackCursor = createCursor((null: ?CX)); - let contextFiberStackCursor : StackCursor = createCursor((null: ?Fiber)); - let rootInstanceStackCursor : StackCursor = createCursor((null: ?C)); + let contextStackCursor : StackCursor = createCursor((null: ?CX)); + let contextFiberStackCursor : StackCursor = createCursor((null: Fiber | null)); + let rootInstanceStackCursor : StackCursor = createCursor((null: ?C)); function getRootHostContainer() : C { const rootInstance = rootInstanceStackCursor.current; invariant( - rootInstance != null, + rootInstance !== null, 'Expected root container to exist. This error is likely caused by a ' + 'bug in React. Please file an issue.' ); @@ -95,7 +95,9 @@ module.exports = function( 'a bug in React. Please file an issue.' ); - const context = contextStackCursor.current || emptyObject; + const context = contextStackCursor.current !== null ? + contextStackCursor.current : + emptyObject; const nextContext = getChildHostContext(context, fiber.type, rootInstance); // Don't push this Fiber's context unless it's unique. diff --git a/src/renderers/shared/fiber/ReactFiberReconciler.js b/src/renderers/shared/fiber/ReactFiberReconciler.js index ab298f6b6ae..1a429daf0a7 100644 --- a/src/renderers/shared/fiber/ReactFiberReconciler.js +++ b/src/renderers/shared/fiber/ReactFiberReconciler.js @@ -206,7 +206,7 @@ module.exports = function( findHostInstance(fiber : Fiber) : I | TI | null { const hostFiber = findCurrentHostFiber(fiber); - if (!hostFiber) { + if (hostFiber === null) { return null; } return hostFiber.stateNode; diff --git a/src/renderers/shared/fiber/ReactFiberRoot.js b/src/renderers/shared/fiber/ReactFiberRoot.js index 3bb55ff52d9..f93dff9ba3d 100644 --- a/src/renderers/shared/fiber/ReactFiberRoot.js +++ b/src/renderers/shared/fiber/ReactFiberRoot.js @@ -24,10 +24,10 @@ export type FiberRoot = { // Determines if this root has already been added to the schedule for work. isScheduled: boolean, // The work schedule is a linked list. - nextScheduledRoot: ?FiberRoot, + nextScheduledRoot: FiberRoot | null, // Top context object, used by renderSubtreeIntoContainer - context: ?Object, - pendingContext: ?Object, + context: Object | null, + pendingContext: Object | null, }; exports.createFiberRoot = function(containerInfo : any) : FiberRoot { diff --git a/src/renderers/shared/fiber/ReactFiberScheduler.js b/src/renderers/shared/fiber/ReactFiberScheduler.js index d070cf4de40..e88126f6960 100644 --- a/src/renderers/shared/fiber/ReactFiberScheduler.js +++ b/src/renderers/shared/fiber/ReactFiberScheduler.js @@ -22,7 +22,7 @@ export type CapturedError = { componentStack : string, error : Error, errorBoundaryFound : boolean, - errorBoundaryName : ?string, + errorBoundaryName : string | null, willRetry : boolean, }; @@ -134,17 +134,17 @@ module.exports = function(config : HostConfig(config : HostConfig(config : HostConfig root.current.pendingWorkPriority)) { @@ -225,7 +225,7 @@ module.exports = function(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig TaskPriority) { + if (deadline !== null && priorityLevel > TaskPriority) { // The deferred work loop will run until there's no time left in // the current frame. - while (nextUnitOfWork && !deadlineHasExpired) { + while (nextUnitOfWork !== null && !deadlineHasExpired) { if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) { nextUnitOfWork = performUnitOfWork(nextUnitOfWork); // In a deferred work batch, iff nextUnitOfWork returns null, we just // completed a root and a pendingCommit exists. Logically, we could // omit either of the checks in the following condition, but we need // both to satisfy Flow. - if (!nextUnitOfWork && pendingCommit) { + if (nextUnitOfWork === null && pendingCommit !== null) { // If we have time, we should commit the work now. if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) { commitAllWork(pendingCommit); @@ -690,11 +690,11 @@ module.exports = function(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig priorityLevel) { // Priority did not match. Update and keep going. @@ -1110,7 +1104,7 @@ module.exports = function(config : HostConfig(config : HostConfig(config : HostConfig