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

Function startUpdateTimerByLane

packages/react-reconciler/src/ReactProfilerTimer.js:121–198  ·  view source on GitHub ↗
(
  lane: Lane,
  method: string,
  fiber: Fiber | null,
)

Source from the content-addressed store, hash-verified

119}
120
121export function startUpdateTimerByLane(
122 lane: Lane,
123 method: string,
124 fiber: Fiber | null,
125): void {
126 if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
127 return;
128 }
129 if (isGestureRender(lane)) {
130 if (gestureUpdateTime < 0) {
131 gestureUpdateTime = now();
132 gestureUpdateTask = createTask(method);
133 gestureUpdateMethodName = method;
134 if (__DEV__ && fiber != null) {
135 gestureUpdateComponentName = getComponentNameFromFiber(fiber);
136 }
137 const newEventTime = resolveEventTimeStamp();
138 const newEventType = resolveEventType();
139 if (
140 newEventTime !== gestureEventRepeatTime ||
141 newEventType !== gestureEventType
142 ) {
143 gestureEventRepeatTime = -1.1;
144 }
145 gestureEventTime = newEventTime;
146 gestureEventType = newEventType;
147 }
148 } else if (isBlockingLane(lane)) {
149 if (blockingUpdateTime < 0) {
150 blockingUpdateTime = now();
151 blockingUpdateTask = createTask(method);
152 blockingUpdateMethodName = method;
153 if (__DEV__ && fiber != null) {
154 blockingUpdateComponentName = getComponentNameFromFiber(fiber);
155 }
156 if (isAlreadyRendering()) {
157 componentEffectSpawnedUpdate = true;
158 blockingUpdateType = SPAWNED_UPDATE;
159 }
160 const newEventTime = resolveEventTimeStamp();
161 const newEventType = resolveEventType();
162 if (
163 newEventTime !== blockingEventRepeatTime ||
164 newEventType !== blockingEventType
165 ) {
166 blockingEventRepeatTime = -1.1;
167 } else if (newEventType !== null) {
168 // If this is a second update in the same event, we treat it as a spawned update.
169 // This might be a microtask spawned from useEffect, multiple flushSync or
170 // a setState in a microtask spawned after the first setState. Regardless it's bad.
171 blockingUpdateType = SPAWNED_UPDATE;
172 }
173 blockingEventTime = newEventTime;
174 blockingEventType = newEventType;
175 }
176 } else if (isTransitionLane(lane)) {
177 if (transitionUpdateTime < 0) {
178 transitionUpdateTime = now();

Callers 7

ReactFiberHooks.jsFile · 0.90
switchFunction · 0.90
createHydrationContainerFunction · 0.90
updateContainerImplFunction · 0.90
enqueueSetStateFunction · 0.90
enqueueReplaceStateFunction · 0.90
enqueueForceUpdateFunction · 0.90

Calls 9

isGestureRenderFunction · 0.90
resolveEventTimeStampFunction · 0.90
resolveEventTypeFunction · 0.90
isBlockingLaneFunction · 0.90
isAlreadyRenderingFunction · 0.90
isTransitionLaneFunction · 0.90
createTaskFunction · 0.85
nowFunction · 0.50

Tested by

no test coverage detected