(current, workInProgress, renderExpirationTime)
| 9663 | } |
| 9664 | |
| 9665 | function updateContextProvider(current, workInProgress, renderExpirationTime) { |
| 9666 | var providerType = workInProgress.type; |
| 9667 | var context = providerType.context; |
| 9668 | |
| 9669 | var newProps = workInProgress.pendingProps; |
| 9670 | var oldProps = workInProgress.memoizedProps; |
| 9671 | |
| 9672 | if (hasLegacyContextChanged()) { |
| 9673 | // Normally we can bail out on props equality but if context has changed |
| 9674 | // we don't do the bailout and we have to reuse existing props instead. |
| 9675 | } else if (oldProps === newProps) { |
| 9676 | workInProgress.stateNode = 0; |
| 9677 | pushProvider(workInProgress); |
| 9678 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9679 | } |
| 9680 | |
| 9681 | var newValue = newProps.value; |
| 9682 | workInProgress.memoizedProps = newProps; |
| 9683 | |
| 9684 | var changedBits = void 0; |
| 9685 | if (oldProps === null) { |
| 9686 | // Initial render |
| 9687 | changedBits = MAX_SIGNED_31_BIT_INT; |
| 9688 | } else { |
| 9689 | if (oldProps.value === newProps.value) { |
| 9690 | // No change. Bailout early if children are the same. |
| 9691 | if (oldProps.children === newProps.children) { |
| 9692 | workInProgress.stateNode = 0; |
| 9693 | pushProvider(workInProgress); |
| 9694 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9695 | } |
| 9696 | changedBits = 0; |
| 9697 | } else { |
| 9698 | var oldValue = oldProps.value; |
| 9699 | // Use Object.is to compare the new context value to the old value. |
| 9700 | // Inlined Object.is polyfill. |
| 9701 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
| 9702 | if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare |
| 9703 | ) { |
| 9704 | // No change. Bailout early if children are the same. |
| 9705 | if (oldProps.children === newProps.children) { |
| 9706 | workInProgress.stateNode = 0; |
| 9707 | pushProvider(workInProgress); |
| 9708 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9709 | } |
| 9710 | changedBits = 0; |
| 9711 | } else { |
| 9712 | changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; |
| 9713 | { |
| 9714 | warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); |
| 9715 | } |
| 9716 | changedBits |= 0; |
| 9717 | |
| 9718 | if (changedBits === 0) { |
| 9719 | // No change. Bailout early if children are the same. |
| 9720 | if (oldProps.children === newProps.children) { |
| 9721 | workInProgress.stateNode = 0; |
| 9722 | pushProvider(workInProgress); |
no test coverage detected