Skip to content

Commit a3a10db

Browse files
Ethan-Arrowoodgaearon
authored andcommitted
Added component stack to contentEditable warning (#11208)
* Added component stack to contentEditable warning * Added component stack to contentEditable warning
1 parent 066f022 commit a3a10db

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,12 @@ describe('ReactDOMComponent', () => {
11261126
spyOn(console, 'error');
11271127
mountComponent({contentEditable: true, children: ''});
11281128
expectDev(console.error.calls.count()).toBe(1);
1129-
expectDev(console.error.calls.argsFor(0)[0]).toContain('contentEditable');
1129+
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1130+
'Warning: A component is `contentEditable` and contains `children` ' +
1131+
'managed by React. It is now your responsibility to guarantee that ' +
1132+
'none of those nodes are unexpectedly modified or duplicated. This ' +
1133+
'is probably not intentional.\n in div (at **)',
1134+
);
11301135
});
11311136

11321137
it('should respect suppressContentEditableWarning', () => {

src/renderers/dom/shared/utils/assertValidProps.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var invariant = require('fbjs/lib/invariant');
1313
var voidElementTags = require('voidElementTags');
1414

1515
if (__DEV__) {
16+
var {getCurrentFiberStackAddendum} = require('ReactDebugCurrentFiber');
1617
var warning = require('fbjs/lib/warning');
1718
}
1819

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

0 commit comments

Comments
 (0)