From 04f9887f0e2a078625e6d8e27c28dd1ec5ffd645 Mon Sep 17 00:00:00 2001 From: Pete Hunt Date: Sun, 16 Mar 2014 21:55:01 -0700 Subject: [PATCH] More actionable error message for and nested

This bites people all of the time. Until we have a better solution, let's just make the error message more actionable (most people don't know how the DOM gets unexpectedly mutated). --- src/browser/ui/ReactMount.js | 6 ++++-- src/core/__tests__/ReactInstanceHandles-test.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/browser/ui/ReactMount.js b/src/browser/ui/ReactMount.js index f98409abb5..1855096a52 100644 --- a/src/browser/ui/ReactMount.js +++ b/src/browser/ui/ReactMount.js @@ -618,8 +618,10 @@ var ReactMount = { invariant( false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + - 'means the DOM was unexpectedly mutated (e.g., by the browser). ' + - 'Try inspecting the child nodes of the element with React ID `%s`.', + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + + 'usually due to forgetting a when using tables or nesting

' + + 'or tags. Try inspecting the child nodes of the element with React ' + + 'ID `%s`.', targetID, ReactMount.getID(ancestorNode) ); diff --git a/src/core/__tests__/ReactInstanceHandles-test.js b/src/core/__tests__/ReactInstanceHandles-test.js index 01dd1de9b5..4a5fe2243e 100644 --- a/src/core/__tests__/ReactInstanceHandles-test.js +++ b/src/core/__tests__/ReactInstanceHandles-test.js @@ -146,8 +146,10 @@ describe('ReactInstanceHandles', function() { }).toThrow( 'Invariant Violation: findComponentRoot(..., .0.1:0:junk): ' + 'Unable to find element. This probably means the DOM was ' + - 'unexpectedly mutated (e.g., by the browser). Try inspecting the ' + - 'child nodes of the element with React ID `.0`.' + 'unexpectedly mutated (e.g., by the browser), usually due to ' + + 'forgetting a when using tables or nesting

or ' + + 'tags. Try inspecting the child nodes of the element with React ' + + 'ID `.0`.' ); }); });