From 620c1bc2ffa0026bc1ac3a238bd1158cb16a06e7 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Mon, 3 Mar 2014 09:40:52 -0800 Subject: [PATCH] Add more owner context to monitoring Always include context and specifically include the component that was missing a key. --- src/core/ReactComponent.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/ReactComponent.js b/src/core/ReactComponent.js index 7ce0d5c8dd..7a72f84d68 100644 --- a/src/core/ReactComponent.js +++ b/src/core/ReactComponent.js @@ -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); }