Allow callbacks to be enqueued during componentWillMount

Since I fixed the server-side rendering it is now possible to trigger these
callbacks on the client alone. They will still be queued up on the server
but they are never executed.
This commit is contained in:
Sebastian Markbage
2015-06-18 13:34:09 -07:00
parent e737acb472
commit 140af9b985
2 changed files with 5 additions and 4 deletions
@@ -117,8 +117,7 @@ var ReactUpdateQueue = {
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
if (!internalInstance ||
internalInstance === ReactLifeCycle.currentlyMountingInstance) {
if (!internalInstance) {
return null;
}
@@ -147,7 +147,7 @@ describe('ReactCompositeComponent-state', function() {
React.unmountComponentAtNode(container);
expect(stateListener.mock.calls).toEqual([
expect(stateListener.mock.calls.join('\n')).toEqual([
// there is no state when getInitialState() is called
['getInitialState', null],
['componentWillMount-start', 'red'],
@@ -173,6 +173,8 @@ describe('ReactCompositeComponent-state', function() {
['render', 'yellow'],
['componentDidUpdate-currentState', 'yellow'],
['componentDidUpdate-prevState', 'orange'],
['setState-sunrise', 'yellow'],
['setState-orange', 'yellow'],
['setState-yellow', 'yellow'],
['initial-callback', 'yellow'],
['componentWillReceiveProps-start', 'yellow'],
@@ -210,7 +212,7 @@ describe('ReactCompositeComponent-state', function() {
// unmountComponent()
// state is available within `componentWillUnmount()`
['componentWillUnmount', 'blue'],
]);
].join('\n'));
});
it('should batch unmounts', function() {