diff --git a/src/browser/ui/ReactMount.js b/src/browser/ui/ReactMount.js index 237c9528fb..1ed572ff5c 100644 --- a/src/browser/ui/ReactMount.js +++ b/src/browser/ui/ReactMount.js @@ -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( diff --git a/src/core/__tests__/ReactCompositeComponent-test.js b/src/core/__tests__/ReactCompositeComponent-test.js index c3b040c0b7..b259f94f57 100644 --- a/src/core/__tests__/ReactCompositeComponent-test.js +++ b/src/core/__tests__/ReactCompositeComponent-test.js @@ -826,10 +826,10 @@ describe('ReactCompositeComponent', function() { ReactTestUtils.renderIntoDocument(); 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.' ); });