@samitouri / QOS-React-2 / commits / 620c1bc2ff

Add more owner context to monitoring

Always include context and specifically include the component that was missing a key.

Sebastian Markbage committed Mar 3, 2014 at 09:40 UTC 620c1bc2ffa0026bc1ac3a238bd1158cb16a06e7
1 file changed +7 -2
src/core/ReactComponent.js
+7 -2
@@ -104,9 +104,11 @@ function validateExplicitKey(component) {
104
105 var message = 'Each child in an array should have a unique "key" prop. ' +
106 'Check the render method of ' + currentName + '.';
107 +
108 + var childOwnerName = null;
109 if (!component.isOwnedBy(ReactCurrentOwner.current)) {
110 // Name of the component that originally created this child.
109 - var childOwnerName =
111 + childOwnerName =
112 component._owner &&
113 component._owner.constructor.displayName;
114
@@ -117,7 +119,10 @@ function validateExplicitKey(component) {
119 }
120
121 message += ' See http://fb.me/react-warning-keys for more information.';
120 - monitorCodeUse('react_key_warning');
122 + monitorCodeUse('react_key_warning', {
123 + component: currentName,
124 + componentOwner: childOwnerName
125 + });
126 console.warn(message);
127 }
128