(current, workInProgress, renderExpirationTime)
| 9738 | } |
| 9739 | |
| 9740 | function updateContextConsumer(current, workInProgress, renderExpirationTime) { |
| 9741 | var context = workInProgress.type; |
| 9742 | var newProps = workInProgress.pendingProps; |
| 9743 | var oldProps = workInProgress.memoizedProps; |
| 9744 | |
| 9745 | var newValue = context._currentValue; |
| 9746 | var changedBits = context._changedBits; |
| 9747 | |
| 9748 | if (hasLegacyContextChanged()) { |
| 9749 | // Normally we can bail out on props equality but if context has changed |
| 9750 | // we don't do the bailout and we have to reuse existing props instead. |
| 9751 | } else if (changedBits === 0 && oldProps === newProps) { |
| 9752 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9753 | } |
| 9754 | workInProgress.memoizedProps = newProps; |
| 9755 | |
| 9756 | var observedBits = newProps.unstable_observedBits; |
| 9757 | if (observedBits === undefined || observedBits === null) { |
| 9758 | // Subscribe to all changes by default |
| 9759 | observedBits = MAX_SIGNED_31_BIT_INT; |
| 9760 | } |
| 9761 | // Store the observedBits on the fiber's stateNode for quick access. |
| 9762 | workInProgress.stateNode = observedBits; |
| 9763 | |
| 9764 | if ((changedBits & observedBits) !== 0) { |
| 9765 | // Context change propagation stops at matching consumers, for time- |
| 9766 | // slicing. Continue the propagation here. |
| 9767 | propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); |
| 9768 | } else if (oldProps !== null && oldProps.children === newProps.children) { |
| 9769 | // No change. Bailout early if children are the same. |
| 9770 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9771 | } |
| 9772 | |
| 9773 | var render = newProps.children; |
| 9774 | |
| 9775 | { |
| 9776 | warning(typeof render === 'function', 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); |
| 9777 | } |
| 9778 | |
| 9779 | var newChildren = render(newValue); |
| 9780 | reconcileChildren(current, workInProgress, newChildren); |
| 9781 | return workInProgress.child; |
| 9782 | } |
| 9783 | |
| 9784 | /* |
| 9785 | function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) { |
no test coverage detected