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

Function markRootFinished

packages/react-reconciler/src/ReactFiberLane.js:889–989  ·  view source on GitHub ↗
(
  root: FiberRoot,
  finishedLanes: Lanes,
  remainingLanes: Lanes,
  spawnedLane: Lane,
  updatedLanes: Lanes,
  suspendedRetryLanes: Lanes,
)

Source from the content-addressed store, hash-verified

887}
888
889export function markRootFinished(
890 root: FiberRoot,
891 finishedLanes: Lanes,
892 remainingLanes: Lanes,
893 spawnedLane: Lane,
894 updatedLanes: Lanes,
895 suspendedRetryLanes: Lanes,
896) {
897 const previouslyPendingLanes = root.pendingLanes;
898 const noLongerPendingLanes = previouslyPendingLanes & ~remainingLanes;
899
900 root.pendingLanes = remainingLanes;
901
902 // Let's try everything again
903 root.suspendedLanes = NoLanes;
904 root.pingedLanes = NoLanes;
905 root.warmLanes = NoLanes;
906
907 if (enableDefaultTransitionIndicator) {
908 root.indicatorLanes &= remainingLanes;
909 }
910
911 root.expiredLanes &= remainingLanes;
912
913 root.entangledLanes &= remainingLanes;
914
915 root.errorRecoveryDisabledLanes &= remainingLanes;
916 root.shellSuspendCounter = 0;
917
918 const entanglements = root.entanglements;
919 const expirationTimes = root.expirationTimes;
920 const hiddenUpdates = root.hiddenUpdates;
921
922 // Clear the lanes that no longer have pending work
923 let lanes = noLongerPendingLanes;
924 while (lanes > 0) {
925 const index = pickArbitraryLaneIndex(lanes);
926 const lane = 1 << index;
927
928 entanglements[index] = NoLanes;
929 expirationTimes[index] = NoTimestamp;
930
931 const hiddenUpdatesForLane = hiddenUpdates[index];
932 if (hiddenUpdatesForLane !== null) {
933 hiddenUpdates[index] = null;
934 // "Hidden" updates are updates that were made to a hidden component. They
935 // have special logic associated with them because they may be entangled
936 // with updates that occur outside that tree. But once the outer tree
937 // commits, they behave like regular updates.
938 for (let i = 0; i < hiddenUpdatesForLane.length; i++) {
939 const update = hiddenUpdatesForLane[i];
940 if (update !== null) {
941 update.lane &= ~OffscreenLane;
942 }
943 }
944 }
945
946 lanes &= ~lane;

Callers 1

commitRootFunction · 0.90

Calls 2

pickArbitraryLaneIndexFunction · 0.85
markSpawnedDeferredLaneFunction · 0.85

Tested by

no test coverage detected