Merge pull request #2946 from benmoss/nested-render-warning

Add displayName to nested render warnings [#1726]
This commit is contained in:
Ben Alpert
2015-03-10 15:24:59 -07:00
2 changed files with 10 additions and 6 deletions
+9 -5
View File
@@ -387,7 +387,9 @@ var ReactMount = {
'_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.'
'componentDidUpdate. Check the render method of %s.',
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
'ReactCompositeComponent'
);
var componentInstance = instantiateReactComponent(nextElement, null);
@@ -569,10 +571,12 @@ var ReactMount = {
// render but we still don't expect to be in a render call here.)
warning(
ReactCurrentOwner.current == null,
'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.'
'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. Check the render method of %s.',
ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
'ReactCompositeComponent'
);
invariant(
@@ -868,7 +868,7 @@ describe('ReactCompositeComponent', function() {
'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.'
);
});