Add more owner context to monitoring

Always include context and specifically include the component that was missing a key.
This commit is contained in:
Sebastian Markbage
2014-03-03 15:06:39 -08:00
committed by Paul O’Shannessy
parent 99dab49f92
commit 620c1bc2ff
+7 -2
View File
@@ -104,9 +104,11 @@ function validateExplicitKey(component) {
var message = 'Each child in an array should have a unique "key" prop. ' +
'Check the render method of ' + currentName + '.';
var childOwnerName = null;
if (!component.isOwnedBy(ReactCurrentOwner.current)) {
// Name of the component that originally created this child.
var childOwnerName =
childOwnerName =
component._owner &&
component._owner.constructor.displayName;
@@ -117,7 +119,10 @@ function validateExplicitKey(component) {
}
message += ' See http://fb.me/react-warning-keys for more information.';
monitorCodeUse('react_key_warning');
monitorCodeUse('react_key_warning', {
component: currentName,
componentOwner: childOwnerName
});
console.warn(message);
}