MCPcopy Index your code
hub / github.com/plotly/dash / validateExplicitKey

Function validateExplicitKey

dash/deps/react@16.14.0.js:1795–1825  ·  view source on GitHub ↗

* Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be * reordered. All children that haven't already been validated are required to * have a "key" property assigned to it. Error statuses are cached so a warnin

(element, parentType)

Source from the content-addressed store, hash-verified

1793
1794
1795 function validateExplicitKey(element, parentType) {
1796 if (!element._store || element._store.validated || element.key != null) {
1797 return;
1798 }
1799
1800 element._store.validated = true;
1801 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1802
1803 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1804 return;
1805 }
1806
1807 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1808 // property, it may be the creator of the child that's responsible for
1809 // assigning it a key.
1810
1811 var childOwner = '';
1812
1813 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1814 // Give the component that originally created this child.
1815 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1816 }
1817
1818 setCurrentlyValidatingElement(element);
1819
1820 {
1821 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1822 }
1823
1824 setCurrentlyValidatingElement(null);
1825 }
1826 /**
1827 * Ensure that every element either is passed in a static location, in an
1828 * array with an explicit keys property defined, or in an object literal

Callers 1

validateChildKeysFunction · 0.70

Calls 4

getComponentNameFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…