(fiber)
| 23930 | } |
| 23931 | |
| 23932 | function getHostSibling(fiber) { |
| 23933 | // We're going to search forward into the tree until we find a sibling host |
| 23934 | // node. Unfortunately, if multiple insertions are done in a row we have to |
| 23935 | // search past them. This leads to exponential search for the next sibling. |
| 23936 | // TODO: Find a more efficient way to do this. |
| 23937 | var node = fiber; |
| 23938 | |
| 23939 | siblings: while (true) { |
| 23940 | // If we didn't find anything, let's try the next sibling. |
| 23941 | while (node.sibling === null) { |
| 23942 | if (node.return === null || isHostParent(node.return)) { |
| 23943 | // If we pop out of the root or hit the parent the fiber we are the |
| 23944 | // last sibling. |
| 23945 | return null; |
| 23946 | } |
| 23947 | |
| 23948 | node = node.return; |
| 23949 | } |
| 23950 | |
| 23951 | node.sibling.return = node.return; |
| 23952 | node = node.sibling; |
| 23953 | |
| 23954 | while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { |
| 23955 | // If it is not host node and, we might have a host node inside it. |
| 23956 | // Try to search down until we find one. |
| 23957 | if (node.effectTag & Placement) { |
| 23958 | // If we don't have a child, try the siblings instead. |
| 23959 | continue siblings; |
| 23960 | } // If we don't have a child, try the siblings instead. |
| 23961 | // We also skip portals because they are not part of this host tree. |
| 23962 | |
| 23963 | |
| 23964 | if (node.child === null || node.tag === HostPortal) { |
| 23965 | continue siblings; |
| 23966 | } else { |
| 23967 | node.child.return = node; |
| 23968 | node = node.child; |
| 23969 | } |
| 23970 | } // Check if this host node is stable or about to be placed. |
| 23971 | |
| 23972 | |
| 23973 | if (!(node.effectTag & Placement)) { |
| 23974 | // Found it! |
| 23975 | return node.stateNode; |
| 23976 | } |
| 23977 | } |
| 23978 | } |
| 23979 | |
| 23980 | function commitPlacement(finishedWork) { |
| 23981 |
no test coverage detected