Merge pull request #1419 from spicyj/inv-process

Add clearer invariant in processUpdates
This commit is contained in:
Cheng Lou
2014-04-17 01:30:58 -07:00
@@ -23,6 +23,7 @@ var Danger = require('Danger');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
var getTextContentAccessor = require('getTextContentAccessor');
var invariant = require('invariant');
/**
* The DOM property to use when setting text content.
@@ -119,6 +120,17 @@ var DOMChildrenOperations = {
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
invariant(
updatedChild,
'processUpdates(): Unable to find child %s of element. This ' +
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
'browser), usually due to forgetting a <tbody> when using tables ' +
'or nesting <p> or <a> tags. Try inspecting the child nodes of the ' +
'element with React ID `%s`.',
updatedIndex,
parentID
);
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;