MCPcopy
hub / github.com/react/react / doesRequireClone

Function doesRequireClone

packages/react-reconciler/src/ReactFiberCompleteWork.js:214–238  ·  view source on GitHub ↗

* In persistent mode, return whether this update needs to clone the subtree.

(current: null | Fiber, completedWork: Fiber)

Source from the content-addressed store, hash-verified

212 * In persistent mode, return whether this update needs to clone the subtree.
213 */
214function doesRequireClone(current: null | Fiber, completedWork: Fiber) {
215 const didBailout = current !== null && current.child === completedWork.child;
216 if (didBailout) {
217 return false;
218 }
219
220 if ((completedWork.flags & ChildDeletion) !== NoFlags) {
221 return true;
222 }
223
224 // TODO: If we move the `doesRequireClone` call after `bubbleProperties`
225 // then we only have to check the `completedWork.subtreeFlags`.
226 let child = completedWork.child;
227 while (child !== null) {
228 const checkedFlags = Cloned | Visibility | Placement | ChildDeletion;
229 if (
230 (child.flags & checkedFlags) !== NoFlags ||
231 (child.subtreeFlags & checkedFlags) !== NoFlags
232 ) {
233 return true;
234 }
235 child = child.sibling;
236 }
237 return false;
238}
239
240function appendAllChildren(
241 parent: Instance,

Callers 2

updateHostContainerFunction · 0.85
updateHostComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected