mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix warning messages wording and access of displayName
This commit is contained in:
@@ -353,11 +353,12 @@ var ReactMount = {
|
||||
// verify that that's the case.
|
||||
warning(
|
||||
ReactCurrentOwner.current == null,
|
||||
'%s._renderNewRootComponent(): Render methods should be a pure ' +
|
||||
'function of props and state; triggering nested component updates from ' +
|
||||
'_renderNewRootComponent(): Render methods should be a pure function ' +
|
||||
'of props and state; triggering nested component updates from ' +
|
||||
'render is not allowed. If necessary, trigger nested updates in ' +
|
||||
'componentDidUpdate.',
|
||||
this.constructor.displayName || 'ReactCompositeComponent'
|
||||
'componentDidUpdate. Check the render method of %s.',
|
||||
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
|
||||
'ReactCompositeComponent'
|
||||
);
|
||||
|
||||
var componentInstance = instantiateReactComponent(nextComponent, null);
|
||||
@@ -519,11 +520,12 @@ var ReactMount = {
|
||||
// render but we still don't expect to be in a render call here.)
|
||||
warning(
|
||||
ReactCurrentOwner.current == null,
|
||||
'%s.unmountComponentAtNode(): Render methods should be a pure function ' +
|
||||
'unmountComponentAtNode(): Render methods should be a pure function ' +
|
||||
'of props and state; triggering nested component updates from render ' +
|
||||
'is not allowed. If necessary, trigger nested updates in ' +
|
||||
'componentDidUpdate.',
|
||||
this.constructor.displayName || 'ReactCompositeComponent'
|
||||
'componentDidUpdate. Check the render method of %s.',
|
||||
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
|
||||
'ReactCompositeComponent'
|
||||
);
|
||||
|
||||
invariant(
|
||||
|
||||
@@ -826,10 +826,10 @@ describe('ReactCompositeComponent', function() {
|
||||
ReactTestUtils.renderIntoDocument(<Outer />);
|
||||
expect(console.warn.argsForCall.length).toBe(1);
|
||||
expect(console.warn.argsForCall[0][0]).toBe(
|
||||
'Warning: ReactCompositeComponent._renderNewRootComponent(): Render methods should ' +
|
||||
'Warning: _renderNewRootComponent(): Render methods should ' +
|
||||
'be a pure function of props and state; triggering nested component ' +
|
||||
'updates from render is not allowed. If necessary, trigger nested ' +
|
||||
'updates in componentDidUpdate.'
|
||||
'updates in componentDidUpdate. Check the render method of Outer.'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user