Remove sometimes-confusing console error
Fixes #767. This essentially reverts 738de8c. We could store some sort of flag to silence the console error here but since we've made significant improvements in markup wrapping, this error is fairly rare now. We'll also have validation of node structure soon in #735.
Ben Alpert committed
Dec 31, 2013 at 13:37 UTC
261926303d61b9881670e4ebb8f7a93544c85d14
2 files changed
+4
-14
src/core/ReactMount.js
+2
-8
@@ -576,17 +576,11 @@ var ReactMount = {
576
577
firstChildren.length = 0;
578
579
- if (__DEV__) {
580
- console.error(
581
- 'Error while invoking `findComponentRoot` with the following ' +
582
- 'ancestor node:',
583
- ancestorNode
584
- );
585
- }
579
invariant(
580
false,
581
'findComponentRoot(..., %s): Unable to find element. This probably ' +
589
- 'means the DOM was unexpectedly mutated (e.g. by the browser).',
582
+ 'means the DOM was unexpectedly mutated (e.g., by the browser). ' +
583
+ 'Try inspecting the child nodes of the element with React ID `%s`.',
584
id,
585
ReactMount.getID(ancestorNode)
586
);
src/core/__tests__/ReactInstanceHandles-test.js
+2
-6
@@ -138,9 +138,6 @@ describe('ReactInstanceHandles', function() {
138
ReactMount.getID(childNodeB)
139
)).toBe(childNodeB);
140
141
- spyOn(console, 'error');
142
- expect(console.error.argsForCall.length).toBe(0);
143
-
141
expect(function() {
142
ReactMount.findComponentRoot(
143
parentNode,
@@ -149,10 +146,9 @@ describe('ReactInstanceHandles', function() {
146
}).toThrow(
147
'Invariant Violation: findComponentRoot(..., .react[0].1:0:junk): ' +
148
'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]`.'
151
);
154
-
155
- expect(console.error.argsForCall.length).toBe(1);
152
});
153
});
154