Skip to content

Commit c28e1f2

Browse files
committed
Merge pull request #768 from spicyj/findcomponentroot-err
Remove sometimes-confusing console error
2 parents ba6c82a + 2619263 commit c28e1f2

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/core/ReactMount.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,11 @@ var ReactMount = {
559559

560560
firstChildren.length = 0;
561561

562-
if (__DEV__) {
563-
console.error(
564-
'Error while invoking `findComponentRoot` with the following ' +
565-
'ancestor node:',
566-
ancestorNode
567-
);
568-
}
569562
invariant(
570563
false,
571564
'findComponentRoot(..., %s): Unable to find element. This probably ' +
572-
'means the DOM was unexpectedly mutated (e.g. by the browser).',
565+
'means the DOM was unexpectedly mutated (e.g., by the browser). ' +
566+
'Try inspecting the child nodes of the element with React ID `%s`.',
573567
id,
574568
ReactMount.getID(ancestorNode)
575569
);

src/core/__tests__/ReactInstanceHandles-test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ describe('ReactInstanceHandles', function() {
138138
ReactMount.getID(childNodeB)
139139
)).toBe(childNodeB);
140140

141-
spyOn(console, 'error');
142-
expect(console.error.argsForCall.length).toBe(0);
143-
144141
expect(function() {
145142
ReactMount.findComponentRoot(
146143
parentNode,
@@ -149,10 +146,9 @@ describe('ReactInstanceHandles', function() {
149146
}).toThrow(
150147
'Invariant Violation: findComponentRoot(..., .react[0].1:0:junk): ' +
151148
'Unable to find element. This probably means the DOM was ' +
152-
'unexpectedly mutated (e.g. by the browser).'
149+
'unexpectedly mutated (e.g., by the browser). Try inspecting the ' +
150+
'child nodes of the element with React ID `.react[0]`.'
153151
);
154-
155-
expect(console.error.argsForCall.length).toBe(1);
156152
});
157153
});
158154

0 commit comments

Comments
 (0)