mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user