Skip to content

Commit

Permalink
Added component stack to contentEditable warning (#11208)
Browse files Browse the repository at this point in the history
* Added component stack to contentEditable warning

* Added component stack to contentEditable warning
  • Loading branch information
Ethan-Arrowood authored and gaearon committed Oct 18, 2017
1 parent 066f022 commit a3a10db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,12 @@ describe('ReactDOMComponent', () => {
spyOn(console, 'error');
mountComponent({contentEditable: true, children: ''});
expectDev(console.error.calls.count()).toBe(1);
expectDev(console.error.calls.argsFor(0)[0]).toContain('contentEditable');
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: A component is `contentEditable` and contains `children` ' +
'managed by React. It is now your responsibility to guarantee that ' +
'none of those nodes are unexpectedly modified or duplicated. This ' +
'is probably not intentional.\n in div (at **)',
);
});

it('should respect suppressContentEditableWarning', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/renderers/dom/shared/utils/assertValidProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var invariant = require('fbjs/lib/invariant');
var voidElementTags = require('voidElementTags');

if (__DEV__) {
var {getCurrentFiberStackAddendum} = require('ReactDebugCurrentFiber');
var warning = require('fbjs/lib/warning');
}

Expand Down Expand Up @@ -68,7 +69,8 @@ function assertValidProps(
'A component is `contentEditable` and contains `children` managed by ' +
'React. It is now your responsibility to guarantee that none of ' +
'those nodes are unexpectedly modified or duplicated. This is ' +
'probably not intentional.',
'probably not intentional.%s',
getCurrentFiberStackAddendum() || '',
);
}
invariant(
Expand Down

0 comments on commit a3a10db

Please sign in to comment.