@samitouri / QOS-React-2 / commits / ba55716a2d

Fix warning messages wording and access of displayName

Ben Moss committed Feb 2, 2015 at 18:00 UTC ba55716a2d8a73fef2f0bfdcf191eb3858166380
2 files changed +11 -9
src/browser/ui/ReactMount.js
+9 -7
@@ -353,11 +353,12 @@ var ReactMount = {
353 // verify that that's the case.
354 warning(
355 ReactCurrentOwner.current == null,
356 - '%s._renderNewRootComponent(): Render methods should be a pure ' +
357 - 'function of props and state; triggering nested component updates from ' +
356 + '_renderNewRootComponent(): Render methods should be a pure function ' +
357 + 'of props and state; triggering nested component updates from ' +
358 'render is not allowed. If necessary, trigger nested updates in ' +
359 - 'componentDidUpdate.',
360 - this.constructor.displayName || 'ReactCompositeComponent'
359 + 'componentDidUpdate. Check the render method of %s.',
360 + ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
361 + 'ReactCompositeComponent'
362 );
363
364 var componentInstance = instantiateReactComponent(nextComponent, null);
@@ -519,11 +520,12 @@ var ReactMount = {
520 // render but we still don't expect to be in a render call here.)
521 warning(
522 ReactCurrentOwner.current == null,
522 - '%s.unmountComponentAtNode(): Render methods should be a pure function ' +
523 + 'unmountComponentAtNode(): Render methods should be a pure function ' +
524 'of props and state; triggering nested component updates from render ' +
525 'is not allowed. If necessary, trigger nested updates in ' +
525 - 'componentDidUpdate.',
526 - this.constructor.displayName || 'ReactCompositeComponent'
526 + 'componentDidUpdate. Check the render method of %s.',
527 + ReactCurrentOwner.current && ReactCurrentOwner.current.getName() ||
528 + 'ReactCompositeComponent'
529 );
530
531 invariant(
src/core/__tests__/ReactCompositeComponent-test.js
+2 -2
@@ -826,10 +826,10 @@ 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: ReactCompositeComponent._renderNewRootComponent(): Render methods should ' +
829 + 'Warning: _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.'
832 + 'updates in componentDidUpdate. Check the render method of Outer.'
833 );
834 });
835