MCPcopy Create free account
hub / github.com/reactjs/react-rails / hideOrUnhideAllChildren

Function hideOrUnhideAllChildren

lib/assets/react-source/development/react.js:23647–23699  ·  view source on GitHub ↗
(finishedWork, isHidden)

Source from the content-addressed store, hash-verified

23645 }
23646
23647 function hideOrUnhideAllChildren(finishedWork, isHidden) {
23648 {
23649 // We only have the top Fiber that was inserted but we need to recurse down its
23650 // children to find all the terminal nodes.
23651 var node = finishedWork;
23652
23653 while (true) {
23654 if (node.tag === HostComponent) {
23655 var instance = node.stateNode;
23656
23657 if (isHidden) {
23658 hideInstance(instance);
23659 } else {
23660 unhideInstance(node.stateNode, node.memoizedProps);
23661 }
23662 } else if (node.tag === HostText) {
23663 var _instance3 = node.stateNode;
23664
23665 if (isHidden) {
23666 hideTextInstance(_instance3);
23667 } else {
23668 unhideTextInstance(_instance3, node.memoizedProps);
23669 }
23670 } else if (node.tag === SuspenseComponent && node.memoizedState !== null && node.memoizedState.dehydrated === null) {
23671 // Found a nested Suspense component that timed out. Skip over the
23672 // primary child fragment, which should remain hidden.
23673 var fallbackChildFragment = node.child.sibling;
23674 fallbackChildFragment.return = node;
23675 node = fallbackChildFragment;
23676 continue;
23677 } else if (node.child !== null) {
23678 node.child.return = node;
23679 node = node.child;
23680 continue;
23681 }
23682
23683 if (node === finishedWork) {
23684 return;
23685 }
23686
23687 while (node.sibling === null) {
23688 if (node.return === null || node.return === finishedWork) {
23689 return;
23690 }
23691
23692 node = node.return;
23693 }
23694
23695 node.sibling.return = node.return;
23696 node = node.sibling;
23697 }
23698 }
23699 }
23700
23701 function commitAttachRef(finishedWork) {
23702 var ref = finishedWork.ref;

Callers 1

commitSuspenseComponentFunction · 0.85

Calls 4

hideInstanceFunction · 0.85
unhideInstanceFunction · 0.85
hideTextInstanceFunction · 0.85
unhideTextInstanceFunction · 0.85

Tested by

no test coverage detected