@samitouri / QOS-React-2 / commits / bf24dc33f7

Separate replaceState invariant violations

It'd be nice if we knew which error we were hitting when this invariant hit.

John Watson committed Dec 4, 2013 at 17:47 UTC bf24dc33f7ef77a0b768f0c6885923d79184a99f
1 file changed +8 -5
src/core/ReactCompositeComponent.js
+8 -5
@@ -424,11 +424,14 @@ function validateLifeCycleOnReplaceState(instance) {
424 compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
425 'replaceState(...): Can only update a mounted or mounting component.'
426 );
427 - invariant(
428 - compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
429 - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
430 - 'replaceState(...): Cannot update while unmounting component or during ' +
431 - 'an existing state transition (such as within `render`).'
427 + invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE,
428 + 'replaceState(...): Cannot update during an existing state transition ' +
429 + '(such as within `render`). This could potentially cause an infinite ' +
430 + 'loop so it is forbidden.'
431 + );
432 + invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
433 + 'replaceState(...): Cannot update while unmounting component. This ' +
434 + 'usually means you called setState() on an unmounted component.'
435 );
436 }
437