mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Separate replaceState invariant violations
It'd be nice if we knew which error we were hitting when this invariant hit.
This commit is contained in:
committed by
Paul O’Shannessy
parent
e3ad088ff3
commit
bf24dc33f7
@@ -424,11 +424,14 @@ function validateLifeCycleOnReplaceState(instance) {
|
||||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
|
||||
'replaceState(...): Can only update a mounted or mounting component.'
|
||||
);
|
||||
invariant(
|
||||
compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
|
||||
compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
|
||||
'replaceState(...): Cannot update while unmounting component or during ' +
|
||||
'an existing state transition (such as within `render`).'
|
||||
invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE,
|
||||
'replaceState(...): Cannot update during an existing state transition ' +
|
||||
'(such as within `render`). This could potentially cause an infinite ' +
|
||||
'loop so it is forbidden.'
|
||||
);
|
||||
invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
|
||||
'replaceState(...): Cannot update while unmounting component. This ' +
|
||||
'usually means you called setState() on an unmounted component.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user