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

Function prepareFreshStack

packages/react-reconciler/src/ReactFiberWorkLoop.js:1932–2202  ·  view source on GitHub ↗
(root: FiberRoot, lanes: Lanes)

Source from the content-addressed store, hash-verified

1930}
1931
1932function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1933 if (enableProfilerTimer && enableComponentPerformanceTrack) {
1934 // The order of tracks within a group are determined by the earliest start time.
1935 // Are tracks should show up in priority order and we should ideally always show
1936 // every track. This is a hack to ensure that we're displaying all tracks in the
1937 // right order. Ideally we could do this only once but because calls that aren't
1938 // recorded aren't considered for ordering purposes, we need to keep adding these
1939 // over and over again in case recording has just started. We can't tell when
1940 // recording starts.
1941 markAllLanesInOrder();
1942
1943 const previousRenderStartTime = renderStartTime;
1944 // Starting a new render. Log the end of any previous renders and the
1945 // blocked time before the render started.
1946 recordRenderTime();
1947 // If this was a restart, e.g. due to an interrupting update, then there's no space
1948 // in the track to log the cause since we'll have rendered all the way up until the
1949 // restart so we need to clamp that.
1950 if (
1951 workInProgressRootRenderLanes !== NoLanes &&
1952 previousRenderStartTime > 0
1953 ) {
1954 setCurrentTrackFromLanes(workInProgressRootRenderLanes);
1955 if (
1956 workInProgressRootExitStatus === RootSuspended ||
1957 workInProgressRootExitStatus === RootSuspendedWithDelay
1958 ) {
1959 // If the root was already suspended when it got interrupted and restarted,
1960 // then this is considered a prewarm and not an interrupted render because
1961 // we couldn't have shown anything anyway so it's not a bad thing that we
1962 // got interrupted.
1963 logSuspendedRenderPhase(
1964 previousRenderStartTime,
1965 renderStartTime,
1966 lanes,
1967 workInProgressUpdateTask,
1968 );
1969 } else {
1970 logInterruptedRenderPhase(
1971 previousRenderStartTime,
1972 renderStartTime,
1973 lanes,
1974 workInProgressUpdateTask,
1975 );
1976 }
1977 finalizeRender(workInProgressRootRenderLanes, renderStartTime);
1978 }
1979 const previousUpdateTask = workInProgressUpdateTask;
1980
1981 workInProgressUpdateTask = null;
1982 if (isGestureRender(lanes)) {
1983 workInProgressUpdateTask = gestureUpdateTask;
1984 const clampedUpdateTime =
1985 gestureUpdateTime >= 0 && gestureUpdateTime < gestureClampTime
1986 ? gestureClampTime
1987 : gestureUpdateTime;
1988 const clampedEventTime =
1989 gestureEventTime >= 0 && gestureEventTime < gestureClampTime

Callers 6

scheduleUpdateOnFiberFunction · 0.85
performWorkOnRootFunction · 0.85
renderRootSyncFunction · 0.85
renderRootConcurrentFunction · 0.85
pingSuspendedRootFunction · 0.85

Calls 15

markAllLanesInOrderFunction · 0.90
recordRenderTimeFunction · 0.90
setCurrentTrackFromLanesFunction · 0.90
logSuspendedRenderPhaseFunction · 0.90
isGestureRenderFunction · 0.90
logAnimatingPhaseFunction · 0.90
logGestureStartFunction · 0.90
clearGestureTimersFunction · 0.90
includesBlockingLaneFunction · 0.90
logBlockingStartFunction · 0.90

Tested by

no test coverage detected