GeezerVison is showing github.com — Add an early invariant to debug a mystery crash (#18159) · react/react@4ee592e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.js +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,7 @@ import { | 34 | 34 | enableUserTimingAPI, | 35 | 35 | enableScopeAPI, | 36 | 36 | enableBlocksAPI, | | 37 | + throwEarlyForMysteriousError, | 37 | 38 | } from 'shared/ReactFeatureFlags'; | 38 | 39 | import {NoEffect, Placement} from 'shared/ReactSideEffectTags'; | 39 | 40 | import {ConcurrentRoot, BlockingRoot} from 'shared/ReactRootTags'; | @@ -453,6 +454,18 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber { | 453 | 454 | } | 454 | 455 | } | 455 | 456 |
| | 457 | + if (throwEarlyForMysteriousError) { | | 458 | + // Trying to debug a mysterious internal-only production failure. | | 459 | + // See D20130868 and t62461245. | | 460 | + // This is only on for RN FB builds. | | 461 | + if (current == null) { | | 462 | + throw Error('current is ' + current + " but it can't be"); | | 463 | + } | | 464 | + if (workInProgress == null) { | | 465 | + throw Error('workInProgress is ' + workInProgress + " but it can't be"); | | 466 | + } | | 467 | + } | | 468 | + | 456 | 469 | workInProgress.childExpirationTime = current.childExpirationTime; | 457 | 470 | workInProgress.expirationTime = current.expirationTime; | 458 | 471 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/ReactFeatureFlags.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,6 +105,9 @@ export const deferPassiveEffectCleanupDuringUnmount = false; | 105 | 105 | // a deprecated pattern we want to get rid of in the future | 106 | 106 | export const warnAboutSpreadingKeyToJSX = false; | 107 | 107 |
| | 108 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 109 | +export const throwEarlyForMysteriousError = false; | | 110 | + | 108 | 111 | // -------------------------- | 109 | 112 | // Future APIs to be deprecated | 110 | 113 | // -------------------------- | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-fb.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,6 +50,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 50 | 50 | export const enableModernEventSystem = false; | 51 | 51 | export const warnAboutSpreadingKeyToJSX = false; | 52 | 52 |
| | 53 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 54 | +export const throwEarlyForMysteriousError = true; | | 55 | + | 53 | 56 | // Only used in www builds. | 54 | 57 | export function addUserTimingListener() { | 55 | 58 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.native-oss.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.persistent.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.testing.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.testing.www.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false; | 45 | 45 | export const enableModernEventSystem = false; | 46 | 46 | export const warnAboutSpreadingKeyToJSX = false; | 47 | 47 |
| | 48 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 49 | +export const throwEarlyForMysteriousError = false; | | 50 | + | 48 | 51 | // Only used in www builds. | 49 | 52 | export function addUserTimingListener() { | 50 | 53 | invariant(false, 'Not implemented.'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.www.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -99,6 +99,9 @@ export const warnUnstableRenderSubtreeIntoContainer = false; | 99 | 99 |
| 100 | 100 | export const enableModernEventSystem = false; | 101 | 101 |
| | 102 | +// Internal-only attempt to debug a React Native issue. See D20130868. | | 103 | +export const throwEarlyForMysteriousError = false; | | 104 | + | 102 | 105 | // Flow magic to verify the exports of this file match the original version. | 103 | 106 | // eslint-disable-next-line no-unused-vars | 104 | 107 | type Check<_X, Y: _X, X: Y = _X> = null; | |
|