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

Function validateExplicitKey

dash/deps/react@18.2.0.js:2155–2185  ·  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

2153
2154
2155 function validateExplicitKey(element, parentType) {
2156 if (!element._store || element._store.validated || element.key != null) {
2157 return;
2158 }
2159
2160 element._store.validated = true;
2161 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2162
2163 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2164 return;
2165 }
2166
2167 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2168 // property, it may be the creator of the child that's responsible for
2169 // assigning it a key.
2170
2171 var childOwner = '';
2172
2173 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2174 // Give the component that originally created this child.
2175 childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
2176 }
2177
2178 {
2179 setCurrentlyValidatingElement$1(element);
2180
2181 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
2182
2183 setCurrentlyValidatingElement$1(null);
2184 }
2185 }
2186 /**
2187 * Ensure that every element either is passed in a static location, in an
2188 * array with an explicit keys property defined, or in an object literal

Callers 1

validateChildKeysFunction · 0.70

Calls 4

getComponentNameFromTypeFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…