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:
John Watson
2013-12-04 20:27:24 -08:00
committed by Paul O’Shannessy
parent e3ad088ff3
commit bf24dc33f7
+8 -5
View File
@@ -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.'
);
}