mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add more owner context to monitoring
Always include context and specifically include the component that was missing a key.
This commit is contained in:
committed by
Paul O’Shannessy
parent
99dab49f92
commit
620c1bc2ff
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user