(current, workInProgress, renderExpirationTime)
| 10302 | } |
| 10303 | |
| 10304 | function updateContextProvider(current, workInProgress, renderExpirationTime) { |
| 10305 | var providerType = workInProgress.type; |
| 10306 | var context = providerType.context; |
| 10307 | |
| 10308 | var newProps = workInProgress.pendingProps; |
| 10309 | var oldProps = workInProgress.memoizedProps; |
| 10310 | |
| 10311 | if (hasLegacyContextChanged()) { |
| 10312 | // Normally we can bail out on props equality but if context has changed |
| 10313 | // we don't do the bailout and we have to reuse existing props instead. |
| 10314 | } else if (oldProps === newProps) { |
| 10315 | workInProgress.stateNode = 0; |
| 10316 | pushProvider(workInProgress); |
| 10317 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10318 | } |
| 10319 | |
| 10320 | var newValue = newProps.value; |
| 10321 | workInProgress.memoizedProps = newProps; |
| 10322 | |
| 10323 | var changedBits = void 0; |
| 10324 | if (oldProps === null) { |
| 10325 | // Initial render |
| 10326 | changedBits = MAX_SIGNED_31_BIT_INT; |
| 10327 | } else { |
| 10328 | if (oldProps.value === newProps.value) { |
| 10329 | // No change. Bailout early if children are the same. |
| 10330 | if (oldProps.children === newProps.children) { |
| 10331 | workInProgress.stateNode = 0; |
| 10332 | pushProvider(workInProgress); |
| 10333 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10334 | } |
| 10335 | changedBits = 0; |
| 10336 | } else { |
| 10337 | var oldValue = oldProps.value; |
| 10338 | // Use Object.is to compare the new context value to the old value. |
| 10339 | // Inlined Object.is polyfill. |
| 10340 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
| 10341 | if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare |
| 10342 | ) { |
| 10343 | // No change. Bailout early if children are the same. |
| 10344 | if (oldProps.children === newProps.children) { |
| 10345 | workInProgress.stateNode = 0; |
| 10346 | pushProvider(workInProgress); |
| 10347 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10348 | } |
| 10349 | changedBits = 0; |
| 10350 | } else { |
| 10351 | changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; |
| 10352 | { |
| 10353 | warning((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); |
| 10354 | } |
| 10355 | changedBits |= 0; |
| 10356 | |
| 10357 | if (changedBits === 0) { |
| 10358 | // No change. Bailout early if children are the same. |
| 10359 | if (oldProps.children === newProps.children) { |
| 10360 | workInProgress.stateNode = 0; |
| 10361 | pushProvider(workInProgress); |
no test coverage detected