diff --git a/src/core/ReactInstanceHandles.js b/src/core/ReactInstanceHandles.js index 000856604b..02ea765e0a 100644 --- a/src/core/ReactInstanceHandles.js +++ b/src/core/ReactInstanceHandles.js @@ -296,12 +296,15 @@ var ReactInstanceHandles = { } child = child.nextSibling; } + global.console && console.error && console.error( + 'Error while invoking `findComponentRoot` with the following ' + + 'ancestor node:', + ancestorNode + ); invariant( false, - 'findComponentRoot: Unable to find element by React ID, `%s`. This ' + - 'indicates that someone (or the browser) has mutated the DOM tree in ' + - 'an unexpected way. Try inspecting the child nodes of the element with ' + - 'React ID, `%s`.', + 'findComponentRoot(..., %s): Unable to find element. This probably ' + + 'means the DOM was unexpectedly mutated (e.g. by the browser).', id, ReactID.getID(ancestorNode) ); diff --git a/src/core/__tests__/ReactInstanceHandles-test.js b/src/core/__tests__/ReactInstanceHandles-test.js index 4cde75ab5d..110612c1c8 100644 --- a/src/core/__tests__/ReactInstanceHandles-test.js +++ b/src/core/__tests__/ReactInstanceHandles-test.js @@ -139,10 +139,9 @@ describe('ReactInstanceHandles', function() { ReactID.getID(childNodeB) ); }).toThrow( - 'Invariant Violation: findComponentRoot: Unable to find element by ' + - 'React ID, `.react[0].1:0`. This indicates that someone (or the ' + - 'browser) has mutated the DOM tree in an unexpected way. Try ' + - 'inspecting the child nodes of the element with React ID, `.react[0]`.' + 'Invariant Violation: findComponentRoot(..., .react[0].1:0): Unable ' + + 'to find element. This probably means the DOM was unexpectedly ' + + 'mutated (e.g. by the browser).' ); }); });