@samitouri / QOS-React-2 / commits / 28f50c8a78

Add displayName to nested render warnings [#1726]

Ben Moss committed Jan 26, 2015 at 14:14 UTC 28f50c8a78cffc0b0e9d60e4a7c77cc14a8e80c7
2 files changed +10 -8
src/browser/ui/ReactMount.js
+9 -7
@@ -353,10 +353,11 @@ var ReactMount = {
353 // verify that that's the case.
354 warning(
355 ReactCurrentOwner.current == null,
356 - '_renderNewRootComponent(): Render methods should be a pure function ' +
357 - 'of props and state; triggering nested component updates from ' +
356 + '%s._renderNewRootComponent(): Render methods should be a pure ' +
357 + 'function of props and state; triggering nested component updates from ' +
358 'render is not allowed. If necessary, trigger nested updates in ' +
359 - 'componentDidUpdate.'
359 + 'componentDidUpdate.',
360 + this.constructor.displayName || 'ReactCompositeComponent'
361 );
362
363 var componentInstance = instantiateReactComponent(nextComponent, null);
@@ -518,10 +519,11 @@ var ReactMount = {
519 // render but we still don't expect to be in a render call here.)
520 warning(
521 ReactCurrentOwner.current == null,
521 - 'unmountComponentAtNode(): Render methods should be a pure function of ' +
522 - 'props and state; triggering nested component updates from render is ' +
523 - 'not allowed. If necessary, trigger nested updates in ' +
524 - 'componentDidUpdate.'
522 + '%s.unmountComponentAtNode(): Render methods should be a pure function ' +
523 + 'of props and state; triggering nested component updates from render ' +
524 + 'is not allowed. If necessary, trigger nested updates in ' +
525 + 'componentDidUpdate.',
526 + this.constructor.displayName || 'ReactCompositeComponent'
527 );
528
529 invariant(
src/core/__tests__/ReactCompositeComponent-test.js
+1 -1
@@ -826,7 +826,7 @@ describe('ReactCompositeComponent', function() {
826 ReactTestUtils.renderIntoDocument(<Outer />);
827 expect(console.warn.argsForCall.length).toBe(1);
828 expect(console.warn.argsForCall[0][0]).toBe(
829 - 'Warning: _renderNewRootComponent(): Render methods should ' +
829 + 'Warning: ReactCompositeComponent._renderNewRootComponent(): Render methods should ' +
830 'be a pure function of props and state; triggering nested component ' +
831 'updates from render is not allowed. If necessary, trigger nested ' +
832 'updates in componentDidUpdate.'