diff --git a/src/renderers/shared/fiber/ReactChildFiber.js b/src/renderers/shared/fiber/ReactChildFiber.js index 68d4f7b39cffc..57e28cb02f733 100644 --- a/src/renderers/shared/fiber/ReactChildFiber.js +++ b/src/renderers/shared/fiber/ReactChildFiber.js @@ -72,9 +72,6 @@ const { Deletion, } = ReactTypeOfSideEffect; -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - function coerceRef(current: ?Fiber, element: ReactElement) { let mixedRef = element.ref; if (mixedRef != null && typeof mixedRef !== 'function') { @@ -92,9 +89,10 @@ function coerceRef(current: ?Fiber, element: ReactElement) { } } invariant( - inst, 'Missing owner for string ref %s. (%s)', - mixedRef, - internalErrorMessage + inst, + 'Missing owner for string ref %s. This error is likely caused by a ' + + 'bug in React. Please file an issue.', + mixedRef ); const stringRef = String(mixedRef); // Check if previous string ref matches new string ref @@ -806,8 +804,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) { const iteratorFn = getIteratorFn(newChildrenIterable); invariant( typeof iteratorFn === 'function', - 'An object is not an iterable. (%s)', - internalErrorMessage + 'An object is not an iterable. This error is likely caused by a bug in ' + + 'React. Please file an issue.' ); if (__DEV__) { diff --git a/src/renderers/shared/fiber/ReactFiberBeginWork.js b/src/renderers/shared/fiber/ReactFiberBeginWork.js index 38eb56ca0b587..947ba6ed24ee8 100644 --- a/src/renderers/shared/fiber/ReactFiberBeginWork.js +++ b/src/renderers/shared/fiber/ReactFiberBeginWork.js @@ -71,9 +71,6 @@ if (__DEV__) { var warnedAboutStatelessRefs = {}; } -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function( config : HostConfig, hostContext : HostContext, @@ -347,8 +344,8 @@ module.exports = function( nextProps = memoizedProps; invariant( nextProps !== null, - 'We should always have pending or current props. (%s)', - internalErrorMessage + 'We should always have pending or current props. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } } else if (nextProps === null || memoizedProps === nextProps) { @@ -450,8 +447,8 @@ module.exports = function( function mountIndeterminateComponent(current, workInProgress, priorityLevel) { invariant( current === null, - 'An indeterminate component should never have mounted. (%s)', - internalErrorMessage + 'An indeterminate component should never have mounted. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); var fn = workInProgress.type; var props = workInProgress.pendingProps; @@ -521,8 +518,8 @@ module.exports = function( nextCoroutine = current && current.memoizedProps; invariant( nextCoroutine != null, - 'We should always have pending or current props. (%s)', - internalErrorMessage + 'We should always have pending or current props. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } } else if (nextCoroutine === null || workInProgress.memoizedProps === nextCoroutine) { @@ -587,8 +584,8 @@ module.exports = function( nextChildren = current && current.memoizedProps; invariant( nextChildren != null, - 'We should always have pending or current props. (%s)', - internalErrorMessage + 'We should always have pending or current props. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) { @@ -741,8 +738,8 @@ module.exports = function( default: invariant( false, - 'Unknown unit of work tag. (%s)', - internalErrorMessage + 'Unknown unit of work tag. This error is likely caused by a bug in ' + + 'React. Please file an issue.' ); } } @@ -751,8 +748,8 @@ module.exports = function( invariant( workInProgress.tag === ClassComponent || workInProgress.tag === HostRoot, - 'Invalid type of work. (%s)', - internalErrorMessage + 'Invalid type of work. This error is likely caused by a bug in React. ' + + 'Please file an issue.' ); // Add an error effect so we can handle the error during the commit phase diff --git a/src/renderers/shared/fiber/ReactFiberClassComponent.js b/src/renderers/shared/fiber/ReactFiberClassComponent.js index d4f7d1f5391b0..d135b23531c24 100644 --- a/src/renderers/shared/fiber/ReactFiberClassComponent.js +++ b/src/renderers/shared/fiber/ReactFiberClassComponent.js @@ -40,9 +40,6 @@ var invariant = require('invariant'); const isArray = Array.isArray; -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function( scheduleUpdate : (fiber : Fiber, priorityLevel : PriorityLevel) => void, getPriorityContext : () => PriorityLevel, @@ -262,8 +259,8 @@ module.exports = function( let props = workInProgress.pendingProps; invariant( props, - 'There must be pending props for an initial mount. (%s)', - internalErrorMessage + 'There must be pending props for an initial mount. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); const unmaskedContext = getUnmaskedContext(workInProgress); @@ -305,8 +302,8 @@ module.exports = function( newProps = workInProgress.memoizedProps; invariant( newProps != null, - 'There should always be pending or memoized props. (%s)', - internalErrorMessage + 'There should always be pending or memoized props. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } const newUnmaskedContext = getUnmaskedContext(workInProgress); @@ -372,8 +369,8 @@ module.exports = function( newProps = oldProps; invariant( newProps != null, - 'There should always be pending or memoized props. (%s)', - internalErrorMessage + 'There should always be pending or memoized props. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } const oldContext = instance.context; diff --git a/src/renderers/shared/fiber/ReactFiberCommitWork.js b/src/renderers/shared/fiber/ReactFiberCommitWork.js index dd72e78d241f4..072c482355a51 100644 --- a/src/renderers/shared/fiber/ReactFiberCommitWork.js +++ b/src/renderers/shared/fiber/ReactFiberCommitWork.js @@ -36,9 +36,6 @@ var { var invariant = require('invariant'); -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function( config : HostConfig, captureError : (failedFiber : Fiber, error: Error) => ?Fiber @@ -101,8 +98,8 @@ module.exports = function( } invariant( false, - 'Expected to find a host parent. (%s)', - internalErrorMessage + 'Expected to find a host parent. This error is likely caused by a bug ' + + 'in React. Please file an issue.' ); } @@ -116,8 +113,8 @@ module.exports = function( } invariant( false, - 'Expected to find a host parent. (%s)', - internalErrorMessage + 'Expected to find a host parent. This error is likely caused by a bug ' + + 'in React. Please file an issue.' ); } @@ -188,8 +185,8 @@ module.exports = function( default: invariant( false, - 'Invalid host parent fiber. (%s)', - internalErrorMessage + 'Invalid host parent fiber. This error is likely caused by a bug ' + + 'in React. Please file an issue.' ); } if (parentFiber.effectTag & ContentReset) { @@ -393,8 +390,8 @@ module.exports = function( case HostText: { invariant( finishedWork.stateNode !== null && current != null, - 'This should only be done during updates. (%s)', - internalErrorMessage + 'This should only be done during updates. This error is likely ' + + 'caused by a bug in React. Please file an issue.' ); const textInstance : TI = finishedWork.stateNode; const newText : string = finishedWork.memoizedProps; @@ -411,8 +408,8 @@ module.exports = function( default: { invariant( false, - 'This unit of work tag should not have side-effects. (%s)', - internalErrorMessage + 'This unit of work tag should not have side-effects. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } } @@ -477,8 +474,8 @@ module.exports = function( default: { invariant( false, - 'This unit of work tag should not have side-effects. (%s)', - internalErrorMessage + 'This unit of work tag should not have side-effects. This error is ' + + 'likely caused by a bug in React. Please file an issue.' ); } } diff --git a/src/renderers/shared/fiber/ReactFiberCompleteWork.js b/src/renderers/shared/fiber/ReactFiberCompleteWork.js index a3e8fa397baad..a8c8137f9a5c8 100644 --- a/src/renderers/shared/fiber/ReactFiberCompleteWork.js +++ b/src/renderers/shared/fiber/ReactFiberCompleteWork.js @@ -48,9 +48,6 @@ if (__DEV__) { var invariant = require('invariant'); -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function( config : HostConfig, hostContext : HostContext, @@ -122,8 +119,8 @@ module.exports = function( var coroutine = (workInProgress.memoizedProps : ?ReactCoroutine); invariant( coroutine, - 'Should be resolved by now. (%s)', - internalErrorMessage + 'Should be resolved by now. This error is likely caused by a bug in ' + + 'React. Please file an issue.', ); // First step of the coroutine has completed. Now we need to do the second. @@ -241,8 +238,8 @@ module.exports = function( if (!newProps) { invariant( workInProgress.stateNode !== null, - 'We must have new props for new mounts. (%s)', - internalErrorMessage + 'We must have new props for new mounts. This error is likely ' + + 'caused by a bug in React. Please file an issue.' ); // This can happen when we abort work. return null; @@ -291,8 +288,8 @@ module.exports = function( if (typeof newText !== 'string') { invariant( workInProgress.stateNode !== null, - 'We must have new props for new mounts. (%s)', - internalErrorMessage + 'We must have new props for new mounts. This error is likely ' + + 'caused by a bug in React. Please file an issue.' ); // This can happen when we abort work. return null; @@ -325,15 +322,16 @@ module.exports = function( case IndeterminateComponent: invariant( false, - 'An indeterminate component should have become determinate before completing. (%s)', - internalErrorMessage + 'An indeterminate component should have become determinate before ' + + 'completing. This error is likely caused by a bug in React. Please ' + + 'file an issue.' ); // eslint-disable-next-line no-fallthrough default: invariant( false, - 'Unknown unit of work tag. (%s)', - internalErrorMessage + 'Unknown unit of work tag. This error is likely caused by a bug in ' + + 'React. Please file an issue.' ); } } diff --git a/src/renderers/shared/fiber/ReactFiberHostContext.js b/src/renderers/shared/fiber/ReactFiberHostContext.js index 69c4bb24bdeeb..8abbc538d74c0 100644 --- a/src/renderers/shared/fiber/ReactFiberHostContext.js +++ b/src/renderers/shared/fiber/ReactFiberHostContext.js @@ -36,9 +36,6 @@ export type HostContext = { resetHostContainer() : void, }; -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function( config : HostConfig ) : HostContext { @@ -55,8 +52,8 @@ module.exports = function( const rootInstance = rootInstanceStackCursor.current; invariant( rootInstance != null, - 'Expected root container to exist. (%s)', - internalErrorMessage + 'Expected root container to exist. This error is likely caused by a ' + + 'bug in React. Please file an issue.' ); return rootInstance; } @@ -84,8 +81,8 @@ module.exports = function( const context = contextStackCursor.current; invariant( context != null, - 'Expected host context to exist. (%s)', - internalErrorMessage + 'Expected host context to exist. This error is likely caused by a bug ' + + 'in React. Please file an issue.' ); return context; } @@ -94,8 +91,8 @@ module.exports = function( const rootInstance = rootInstanceStackCursor.current; invariant( rootInstance != null, - 'Expected root host context to exist. (%s)', - internalErrorMessage + 'Expected root host context to exist. This error is likely caused by ' + + 'a bug in React. Please file an issue.' ); const context = contextStackCursor.current || emptyObject; diff --git a/src/renderers/shared/fiber/ReactFiberScheduler.js b/src/renderers/shared/fiber/ReactFiberScheduler.js index 41dd8d6152d29..d070cf4de40a8 100644 --- a/src/renderers/shared/fiber/ReactFiberScheduler.js +++ b/src/renderers/shared/fiber/ReactFiberScheduler.js @@ -92,9 +92,6 @@ if (__DEV__) { var timeHeuristicForUnitOfWork = 1; -const internalErrorMessage = - 'This error is likely caused by a bug in React. Please file an issue.'; - module.exports = function(config : HostConfig) { const hostContext = ReactFiberHostContext(config); const { popHostContainer, popHostContext, resetHostContainer } = hostContext; @@ -348,8 +345,8 @@ module.exports = function(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig(config : HostConfig