MCPcopy Create free account
hub / github.com/BetaSu/big-react / recordHostChildrenToDelete

Function recordHostChildrenToDelete

packages/react-reconciler/src/commitWork.ts:342–362  ·  view source on GitHub ↗
(
	childrenToDelete: FiberNode[],
	unmountFiber: FiberNode
)

Source from the content-addressed store, hash-verified

340}
341
342function recordHostChildrenToDelete(
343 childrenToDelete: FiberNode[],
344 unmountFiber: FiberNode
345) {
346 // 1. 找到第一个root host节点
347 const lastOne = childrenToDelete[childrenToDelete.length - 1];
348
349 if (!lastOne) {
350 childrenToDelete.push(unmountFiber);
351 } else {
352 let node = lastOne.sibling;
353 while (node !== null) {
354 if (unmountFiber === node) {
355 childrenToDelete.push(unmountFiber);
356 }
357 node = node.sibling;
358 }
359 }
360
361 // 2. 每找到一个 host节点,判断下这个节点是不是 1 找到那个节点的兄弟节点
362}
363
364function commitDeletion(childToDelete: FiberNode, root: FiberRootNode) {
365 const rootChildrenToDelete: FiberNode[] = [];

Callers 1

commitDeletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected