MCPcopy
hub / github.com/facebook/react / markRootSuspended

Function markRootSuspended

packages/react-reconciler/src/ReactFiberLane.js:846–880  ·  view source on GitHub ↗
(
  root: FiberRoot,
  suspendedLanes: Lanes,
  spawnedLane: Lane,
  didAttemptEntireTree: boolean,
)

Source from the content-addressed store, hash-verified

844}
845
846export function markRootSuspended(
847 root: FiberRoot,
848 suspendedLanes: Lanes,
849 spawnedLane: Lane,
850 didAttemptEntireTree: boolean,
851) {
852 // TODO: Split this into separate functions for marking the root at the end of
853 // a render attempt versus suspending while the root is still in progress.
854 root.suspendedLanes |= suspendedLanes;
855 root.pingedLanes &= ~suspendedLanes;
856
857 if (didAttemptEntireTree) {
858 // Mark these lanes as warm so we know there's nothing else to work on.
859 root.warmLanes |= suspendedLanes;
860 } else {
861 // Render unwound without attempting all the siblings. Do no mark the lanes
862 // as warm. This will cause a prewarm render to be scheduled.
863 }
864
865 // The suspended lanes are no longer CPU-bound. Clear their expiration times.
866 const expirationTimes = root.expirationTimes;
867 let lanes = suspendedLanes;
868 while (lanes > 0) {
869 const index = pickArbitraryLaneIndex(lanes);
870 const lane = 1 << index;
871
872 expirationTimes[index] = NoTimestamp;
873
874 lanes &= ~lane;
875 }
876
877 if (spawnedLane !== NoLane) {
878 markSpawnedDeferredLane(root, spawnedLane, suspendedLanes);
879 }
880}
881
882export function markRootPinged(root: FiberRoot, pingedLanes: Lanes) {
883 root.pingedLanes |= root.suspendedLanes & pingedLanes;

Callers 5

scheduleUpdateOnFiberFunction · 0.90
performWorkOnRootFunction · 0.90
finishConcurrentRenderFunction · 0.90
commitRootWhenReadyFunction · 0.90

Calls 2

pickArbitraryLaneIndexFunction · 0.85
markSpawnedDeferredLaneFunction · 0.85

Tested by

no test coverage detected