MCPcopy Index your code
hub / github.com/react/react / updatePortal

Function updatePortal

packages/react-reconciler/src/ReactChildFiber.js:617–645  ·  view source on GitHub ↗
(
    returnFiber: Fiber,
    current: Fiber | null,
    portal: ReactPortal,
    lanes: Lanes,
  )

Source from the content-addressed store, hash-verified

615 }
616
617 function updatePortal(
618 returnFiber: Fiber,
619 current: Fiber | null,
620 portal: ReactPortal,
621 lanes: Lanes,
622 ): Fiber {
623 if (
624 current === null ||
625 current.tag !== HostPortal ||
626 current.stateNode.containerInfo !== portal.containerInfo ||
627 current.stateNode.implementation !== portal.implementation
628 ) {
629 // Insert
630 const created = createFiberFromPortal(portal, returnFiber.mode, lanes);
631 created.return = returnFiber;
632 if (__DEV__) {
633 created._debugInfo = currentDebugInfo;
634 }
635 return created;
636 } else {
637 // Update
638 const existing = useFiber(current, portal.children || []);
639 existing.return = returnFiber;
640 if (__DEV__) {
641 existing._debugInfo = currentDebugInfo;
642 }
643 return existing;
644 }
645 }
646
647 function updateFragment(
648 returnFiber: Fiber,

Callers 2

updateSlotFunction · 0.85
updateFromMapFunction · 0.85

Calls 2

createFiberFromPortalFunction · 0.90
useFiberFunction · 0.85

Tested by

no test coverage detected