(current, workInProgress, renderExpirationTime)
| 10470 | } |
| 10471 | |
| 10472 | function updateContextConsumer(current, workInProgress, renderExpirationTime) { |
| 10473 | var context = workInProgress.type; |
| 10474 | var newProps = workInProgress.pendingProps; |
| 10475 | var oldProps = workInProgress.memoizedProps; |
| 10476 | |
| 10477 | var newValue = context._currentValue; |
| 10478 | var changedBits = context._changedBits; |
| 10479 | |
| 10480 | if (hasLegacyContextChanged()) { |
| 10481 | // Normally we can bail out on props equality but if context has changed |
| 10482 | // we don't do the bailout and we have to reuse existing props instead. |
| 10483 | } else if (changedBits === 0 && oldProps === newProps) { |
| 10484 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10485 | } |
| 10486 | workInProgress.memoizedProps = newProps; |
| 10487 | |
| 10488 | var observedBits = newProps.unstable_observedBits; |
| 10489 | if (observedBits === undefined || observedBits === null) { |
| 10490 | // Subscribe to all changes by default |
| 10491 | observedBits = MAX_SIGNED_31_BIT_INT; |
| 10492 | } |
| 10493 | // Store the observedBits on the fiber's stateNode for quick access. |
| 10494 | workInProgress.stateNode = observedBits; |
| 10495 | |
| 10496 | if ((changedBits & observedBits) !== 0) { |
| 10497 | // Context change propagation stops at matching consumers, for time- |
| 10498 | // slicing. Continue the propagation here. |
| 10499 | propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); |
| 10500 | } else if (oldProps !== null && oldProps.children === newProps.children) { |
| 10501 | // No change. Bailout early if children are the same. |
| 10502 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10503 | } |
| 10504 | |
| 10505 | var render = newProps.children; |
| 10506 | |
| 10507 | { |
| 10508 | 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.'); |
| 10509 | } |
| 10510 | |
| 10511 | var newChildren = render(newValue); |
| 10512 | reconcileChildren(current, workInProgress, newChildren); |
| 10513 | return workInProgress.child; |
| 10514 | } |
| 10515 | |
| 10516 | /* |
| 10517 | function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) { |
no test coverage detected