MCPcopy Create free account
hub / github.com/plotly/dash / isCompatibleFamilyForHotReloading

Function isCompatibleFamilyForHotReloading

dash/deps/react-dom@18.3.1.js:27732–27815  ·  view source on GitHub ↗
(fiber, element)

Source from the content-addressed store, hash-verified

27730 }
27731 }
27732 function isCompatibleFamilyForHotReloading(fiber, element) {
27733 {
27734 if (resolveFamily === null) {
27735 // Hot reloading is disabled.
27736 return false;
27737 }
27738
27739 var prevType = fiber.elementType;
27740 var nextType = element.type; // If we got here, we know types aren't === equal.
27741
27742 var needsCompareFamilies = false;
27743 var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
27744
27745 switch (fiber.tag) {
27746 case ClassComponent:
27747 {
27748 if (typeof nextType === 'function') {
27749 needsCompareFamilies = true;
27750 }
27751
27752 break;
27753 }
27754
27755 case FunctionComponent:
27756 {
27757 if (typeof nextType === 'function') {
27758 needsCompareFamilies = true;
27759 } else if ($$typeofNextType === REACT_LAZY_TYPE) {
27760 // We don't know the inner type yet.
27761 // We're going to assume that the lazy inner type is stable,
27762 // and so it is sufficient to avoid reconciling it away.
27763 // We're not going to unwrap or actually use the new lazy type.
27764 needsCompareFamilies = true;
27765 }
27766
27767 break;
27768 }
27769
27770 case ForwardRef:
27771 {
27772 if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
27773 needsCompareFamilies = true;
27774 } else if ($$typeofNextType === REACT_LAZY_TYPE) {
27775 needsCompareFamilies = true;
27776 }
27777
27778 break;
27779 }
27780
27781 case MemoComponent:
27782 case SimpleMemoComponent:
27783 {
27784 if ($$typeofNextType === REACT_MEMO_TYPE) {
27785 // TODO: if it was but can no longer be simple,
27786 // we shouldn't set this.
27787 needsCompareFamilies = true;
27788 } else if ($$typeofNextType === REACT_LAZY_TYPE) {
27789 needsCompareFamilies = true;

Callers 2

updateElementFunction · 0.70
reconcileSingleElementFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…