Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added component stack to contentEditable warning #11208

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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