mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add an early invariant to debug a mystery crash (#18159)
This commit is contained in:
+13
@@ -34,6 +34,7 @@ import {
|
||||
enableUserTimingAPI,
|
||||
enableScopeAPI,
|
||||
enableBlocksAPI,
|
||||
throwEarlyForMysteriousError,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {NoEffect, Placement} from 'shared/ReactSideEffectTags';
|
||||
import {ConcurrentRoot, BlockingRoot} from 'shared/ReactRootTags';
|
||||
@@ -453,6 +454,18 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
|
||||
}
|
||||
}
|
||||
|
||||
if (throwEarlyForMysteriousError) {
|
||||
// Trying to debug a mysterious internal-only production failure.
|
||||
// See D20130868 and t62461245.
|
||||
// This is only on for RN FB builds.
|
||||
if (current == null) {
|
||||
throw Error('current is ' + current + " but it can't be");
|
||||
}
|
||||
if (workInProgress == null) {
|
||||
throw Error('workInProgress is ' + workInProgress + " but it can't be");
|
||||
}
|
||||
}
|
||||
|
||||
workInProgress.childExpirationTime = current.childExpirationTime;
|
||||
workInProgress.expirationTime = current.expirationTime;
|
||||
|
||||
|
||||
@@ -105,6 +105,9 @@ export const deferPassiveEffectCleanupDuringUnmount = false;
|
||||
// a deprecated pattern we want to get rid of in the future
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// --------------------------
|
||||
// Future APIs to be deprecated
|
||||
// --------------------------
|
||||
|
||||
@@ -50,6 +50,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = true;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -45,6 +45,9 @@ export const runAllPassiveEffectDestroysBeforeCreates = false;
|
||||
export const enableModernEventSystem = false;
|
||||
export const warnAboutSpreadingKeyToJSX = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Only used in www builds.
|
||||
export function addUserTimingListener() {
|
||||
invariant(false, 'Not implemented.');
|
||||
|
||||
@@ -99,6 +99,9 @@ export const warnUnstableRenderSubtreeIntoContainer = false;
|
||||
|
||||
export const enableModernEventSystem = false;
|
||||
|
||||
// Internal-only attempt to debug a React Native issue. See D20130868.
|
||||
export const throwEarlyForMysteriousError = false;
|
||||
|
||||
// Flow magic to verify the exports of this file match the original version.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
type Check<_X, Y: _X, X: Y = _X> = null;
|
||||
|
||||
Reference in New Issue
Block a user