(current, workInProgress, renderExpirationTime)
| 10440 | } |
| 10441 | |
| 10442 | function updateContextProvider(current, workInProgress, renderExpirationTime) { |
| 10443 | var providerType = workInProgress.type; |
| 10444 | var context = providerType.context; |
| 10445 | |
| 10446 | var newProps = workInProgress.pendingProps; |
| 10447 | var oldProps = workInProgress.memoizedProps; |
| 10448 | |
| 10449 | if (hasLegacyContextChanged()) { |
| 10450 | // Normally we can bail out on props equality but if context has changed |
| 10451 | // we don't do the bailout and we have to reuse existing props instead. |
| 10452 | } else if (oldProps === newProps) { |
| 10453 | workInProgress.stateNode = 0; |
| 10454 | pushProvider(workInProgress); |
| 10455 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10456 | } |
| 10457 | |
| 10458 | var newValue = newProps.value; |
| 10459 | workInProgress.memoizedProps = newProps; |
| 10460 | |
| 10461 | var changedBits = void 0; |
| 10462 | if (oldProps === null) { |
| 10463 | // Initial render |
| 10464 | changedBits = MAX_SIGNED_31_BIT_INT; |
| 10465 | } else { |
| 10466 | if (oldProps.value === newProps.value) { |
| 10467 | // No change. Bailout early if children are the same. |
| 10468 | if (oldProps.children === newProps.children) { |
| 10469 | workInProgress.stateNode = 0; |
| 10470 | pushProvider(workInProgress); |
| 10471 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10472 | } |
| 10473 | changedBits = 0; |
| 10474 | } else { |
| 10475 | var oldValue = oldProps.value; |
| 10476 | // Use Object.is to compare the new context value to the old value. |
| 10477 | // Inlined Object.is polyfill. |
| 10478 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
| 10479 | if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare |
| 10480 | ) { |
| 10481 | // No change. Bailout early if children are the same. |
| 10482 | if (oldProps.children === newProps.children) { |
| 10483 | workInProgress.stateNode = 0; |
| 10484 | pushProvider(workInProgress); |
| 10485 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10486 | } |
| 10487 | changedBits = 0; |
| 10488 | } else { |
| 10489 | changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; |
| 10490 | { |
| 10491 | warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); |
| 10492 | } |
| 10493 | changedBits |= 0; |
| 10494 | |
| 10495 | if (changedBits === 0) { |
| 10496 | // No change. Bailout early if children are the same. |
| 10497 | if (oldProps.children === newProps.children) { |
| 10498 | workInProgress.stateNode = 0; |
| 10499 | pushProvider(workInProgress); |
no test coverage detected