MCPcopy Index your code
hub / github.com/caseywebdev/react-list / warnOnInvalidKey

Function warnOnInvalidKey

docs/index.js:23598–23627  ·  view source on GitHub ↗
(returnFiber, workInProgress, child, knownKeys)

Source from the content-addressed store, hash-verified

23596 return null;
23597 }
23598 function warnOnInvalidKey(returnFiber, workInProgress, child, knownKeys) {
23599 if ("object" !== typeof child || null === child) return knownKeys;
23600 switch (child.$$typeof) {
23601 case REACT_ELEMENT_TYPE:
23602 case REACT_PORTAL_TYPE:
23603 warnForMissingKey(returnFiber, workInProgress, child);
23604 var key = child.key;
23605 if ("string" !== typeof key) break;
23606 if (null === knownKeys) {
23607 knownKeys = new Set();
23608 knownKeys.add(key);
23609 break;
23610 }
23611 if (!knownKeys.has(key)) {
23612 knownKeys.add(key);
23613 break;
23614 }
23615 runWithFiberInDEV(workInProgress, function () {
23616 console.error(
23617 "Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.",
23618 key
23619 );
23620 });
23621 break;
23622 case REACT_LAZY_TYPE:
23623 (child = callLazyInitInDEV(child)),
23624 warnOnInvalidKey(returnFiber, workInProgress, child, knownKeys);
23625 }
23626 return knownKeys;
23627 }
23628 function reconcileChildrenArray(
23629 returnFiber,
23630 currentFirstChild,

Callers 2

reconcileChildrenArrayFunction · 0.85

Calls 2

warnForMissingKeyFunction · 0.85
runWithFiberInDEVFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…