(current, workInProgress, renderExpirationTime)
| 10628 | } |
| 10629 | |
| 10630 | function updateContextConsumer(current, workInProgress, renderExpirationTime) { |
| 10631 | var context = workInProgress.type; |
| 10632 | var newProps = workInProgress.pendingProps; |
| 10633 | var oldProps = workInProgress.memoizedProps; |
| 10634 | |
| 10635 | var newValue = context._currentValue; |
| 10636 | var changedBits = context._changedBits; |
| 10637 | |
| 10638 | if (hasLegacyContextChanged()) { |
| 10639 | // Normally we can bail out on props equality but if context has changed |
| 10640 | // we don't do the bailout and we have to reuse existing props instead. |
| 10641 | } else if (changedBits === 0 && oldProps === newProps) { |
| 10642 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10643 | } |
| 10644 | workInProgress.memoizedProps = newProps; |
| 10645 | |
| 10646 | var observedBits = newProps.unstable_observedBits; |
| 10647 | if (observedBits === undefined || observedBits === null) { |
| 10648 | // Subscribe to all changes by default |
| 10649 | observedBits = MAX_SIGNED_31_BIT_INT; |
| 10650 | } |
| 10651 | // Store the observedBits on the fiber's stateNode for quick access. |
| 10652 | workInProgress.stateNode = observedBits; |
| 10653 | |
| 10654 | if ((changedBits & observedBits) !== 0) { |
| 10655 | // Context change propagation stops at matching consumers, for time- |
| 10656 | // slicing. Continue the propagation here. |
| 10657 | propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); |
| 10658 | } else if (oldProps !== null && oldProps.children === newProps.children) { |
| 10659 | // No change. Bailout early if children are the same. |
| 10660 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10661 | } |
| 10662 | |
| 10663 | var render = newProps.children; |
| 10664 | |
| 10665 | { |
| 10666 | 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.'); |
| 10667 | } |
| 10668 | |
| 10669 | var newChildren = render(newValue); |
| 10670 | reconcileChildren(current, workInProgress, newChildren); |
| 10671 | return workInProgress.child; |
| 10672 | } |
| 10673 | |
| 10674 | /* |
| 10675 | function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) { |
no test coverage detected