@@ -41,6 +41,13 @@ import * as Scheduler from 'scheduler';
4141
4242const { unstable_now : now } = Scheduler ;
4343
44+ const createTask =
45+ // eslint-disable-next-line react-internal/no-production-logging
46+ __DEV__ && console . createTask
47+ ? // eslint-disable-next-line react-internal/no-production-logging
48+ console . createTask
49+ : ( name : string ) => null ;
50+
4451export let renderStartTime : number = - 0 ;
4552export let commitStartTime : number = - 0 ;
4653export let commitEndTime : number = - 0 ;
@@ -54,6 +61,7 @@ export let componentEffectErrors: null | Array<CapturedValue<mixed>> = null;
5461
5562export let blockingClampTime : number = - 0 ;
5663export let blockingUpdateTime : number = - 1.1 ; // First sync setState scheduled.
64+ export let blockingUpdateTask : null | ConsoleTask = null ; // First sync setState's stack trace.
5765export let blockingEventTime : number = - 1.1 ; // Event timeStamp of the first setState.
5866export let blockingEventType : null | string = null ; // Event type of the first setState.
5967export let blockingEventIsRepeat : boolean = false ;
@@ -63,6 +71,7 @@ export let blockingSuspendedTime: number = -1.1;
6371export let transitionClampTime : number = - 0 ;
6472export let transitionStartTime : number = - 1.1 ; // First startTransition call before setState.
6573export let transitionUpdateTime : number = - 1.1 ; // First transition setState scheduled.
74+ export let transitionUpdateTask : null | ConsoleTask = null ; // First transition setState's stack trace.
6675export let transitionEventTime : number = - 1.1 ; // Event timeStamp of the first transition.
6776export let transitionEventType : null | string = null ; // Event type of the first transition.
6877export let transitionEventIsRepeat : boolean = false ;
@@ -79,13 +88,14 @@ export function startYieldTimer(reason: SuspendedReason) {
7988 yieldReason = reason ;
8089}
8190
82- export function startUpdateTimerByLane ( lane : Lane ) : void {
91+ export function startUpdateTimerByLane ( lane : Lane , method : string ) : void {
8392 if ( ! enableProfilerTimer || ! enableComponentPerformanceTrack ) {
8493 return ;
8594 }
8695 if ( isSyncLane ( lane ) || isBlockingLane ( lane ) ) {
8796 if ( blockingUpdateTime < 0 ) {
8897 blockingUpdateTime = now ( ) ;
98+ blockingUpdateTask = createTask ( method ) ;
8999 if ( isAlreadyRendering ( ) ) {
90100 blockingSpawnedUpdate = true ;
91101 }
@@ -108,6 +118,7 @@ export function startUpdateTimerByLane(lane: Lane): void {
108118 } else if ( isTransitionLane ( lane ) ) {
109119 if ( transitionUpdateTime < 0 ) {
110120 transitionUpdateTime = now ( ) ;
121+ transitionUpdateTask = createTask ( method ) ;
111122 if ( transitionStartTime < 0 ) {
112123 const newEventTime = resolveEventTimeStamp ( ) ;
113124 const newEventType = resolveEventType ( ) ;
@@ -155,6 +166,7 @@ export function trackSuspendedTime(lanes: Lanes, renderEndTime: number) {
155166
156167export function clearBlockingTimers ( ) : void {
157168 blockingUpdateTime = - 1.1 ;
169+ blockingUpdateTask = null ;
158170 blockingSuspendedTime = - 1.1 ;
159171 blockingEventIsRepeat = true ;
160172 blockingSpawnedUpdate = false ;
@@ -194,6 +206,7 @@ export function startActionStateUpdate(): void {
194206 }
195207 if ( transitionUpdateTime < 0 ) {
196208 transitionUpdateTime = ACTION_STATE_MARKER ;
209+ transitionUpdateTask = null ;
197210 }
198211}
199212
@@ -204,6 +217,7 @@ export function clearAsyncTransitionTimer(): void {
204217export function clearTransitionTimers ( ) : void {
205218 transitionStartTime = - 1.1 ;
206219 transitionUpdateTime = - 1.1 ;
220+ transitionUpdateTask = null ;
207221 transitionSuspendedTime = - 1.1 ;
208222 transitionEventIsRepeat = true ;
209223}
0 commit comments