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

Function markSpawnedDeferredLane

packages/react-reconciler/src/ReactFiberLane.js:991–1020  ·  view source on GitHub ↗
(
  root: FiberRoot,
  spawnedLane: Lane,
  entangledLanes: Lanes,
)

Source from the content-addressed store, hash-verified

989}
990
991function markSpawnedDeferredLane(
992 root: FiberRoot,
993 spawnedLane: Lane,
994 entangledLanes: Lanes,
995) {
996 // This render spawned a deferred task. Mark it as pending.
997 root.pendingLanes |= spawnedLane;
998 root.suspendedLanes &= ~spawnedLane;
999
1000 // Entangle the spawned lane with the DeferredLane bit so that we know it
1001 // was the result of another render. This lets us avoid a useDeferredValue
1002 // waterfall — only the first level will defer.
1003 // TODO: Now that there is a reserved set of transition lanes that are used
1004 // exclusively for deferred work, we should get rid of this special
1005 // DeferredLane bit; the same information can be inferred by checking whether
1006 // the lane is one of the TransitionDeferredLanes. The only reason this still
1007 // exists is because we need to also do the same for OffscreenLane. That
1008 // requires additional changes because there are more places around the
1009 // codebase that treat OffscreenLane as a magic value; would need to check
1010 // for a new OffscreenDeferredLane, too. Will leave this for a follow-up.
1011 const spawnedLaneIndex = laneToIndex(spawnedLane);
1012 root.entangledLanes |= spawnedLane;
1013 root.entanglements[spawnedLaneIndex] |=
1014 DeferredLane |
1015 // If the parent render task suspended, we must also entangle those lanes
1016 // with the spawned task, so that the deferred task includes all the same
1017 // updates that the parent task did. We can exclude any lane that is not
1018 // used for updates (e.g. Offscreen).
1019 (entangledLanes & UpdateLanes);
1020}
1021
1022export function markRootEntangled(root: FiberRoot, entangledLanes: Lanes) {
1023 // In addition to entangling each of the given lanes with each other, we also

Callers 2

markRootSuspendedFunction · 0.85
markRootFinishedFunction · 0.85

Calls 1

laneToIndexFunction · 0.85

Tested by

no test coverage detected