@@ -17,17 +17,12 @@ import {getWorkInProgressTransitions} from './ReactFiberWorkLoop.new';
17
17
18
18
export type SuspenseInfo = { name : string | null } ;
19
19
20
- export type MarkerTransition = {
21
- transition : Transition ,
22
- name : string ,
23
- } ;
24
-
25
20
export type PendingTransitionCallbacks = {
26
21
transitionStart : Array < Transition > | null ,
27
- transitionProgress : Map < Transition , PendingSuspenseBoundaries > | null ,
22
+ transitionProgress : Map < Transition , PendingBoundaries > | null ,
28
23
transitionComplete : Array < Transition > | null ,
29
24
markerProgress : Map < string , TracingMarkerInstance> | null ,
30
- markerComplete : Array < MarkerTransition > | null ,
25
+ markerComplete : Map < string , Set < Transition > > | null ,
31
26
} ;
32
27
33
28
export type Transition = {
@@ -42,12 +37,12 @@ export type BatchConfigTransition = {
42
37
} ;
43
38
44
39
export type TracingMarkerInstance = { |
45
- pendingSuspenseBoundaries : PendingSuspenseBoundaries | null ,
40
+ pendingBoundaries : PendingBoundaries | null ,
46
41
transitions : Set < Transition > | null ,
47
42
name ?: string ,
48
43
| } ;
49
44
50
- export type PendingSuspenseBoundaries = Map < OffscreenInstance , SuspenseInfo > ;
45
+ export type PendingBoundaries = Map < OffscreenInstance , SuspenseInfo > ;
51
46
52
47
export function processTransitionCallbacks (
53
48
pendingTransitions : PendingTransitionCallbacks ,
@@ -57,12 +52,11 @@ export function processTransitionCallbacks(
57
52
if ( enableTransitionTracing ) {
58
53
if ( pendingTransitions !== null ) {
59
54
const transitionStart = pendingTransitions . transitionStart ;
60
- if ( transitionStart !== null ) {
61
- transitionStart . forEach ( transition => {
62
- if ( callbacks . onTransitionStart != null ) {
63
- callbacks . onTransitionStart ( transition . name , transition . startTime ) ;
64
- }
65
- } ) ;
55
+ const onTransitionStart = callbacks . onTransitionStart ;
56
+ if ( transitionStart !== null && onTransitionStart != null ) {
57
+ transitionStart . forEach ( transition =>
58
+ onTransitionStart ( transition . name , transition . startTime ) ,
59
+ ) ;
66
60
}
67
61
68
62
const markerProgress = pendingTransitions . markerProgress ;
@@ -71,8 +65,8 @@ export function processTransitionCallbacks(
71
65
markerProgress . forEach ( ( markerInstance , markerName ) => {
72
66
if ( markerInstance . transitions !== null ) {
73
67
const pending =
74
- markerInstance . pendingSuspenseBoundaries !== null
75
- ? Array . from ( markerInstance . pendingSuspenseBoundaries . values ( ) )
68
+ markerInstance . pendingBoundaries !== null
69
+ ? Array . from ( markerInstance . pendingBoundaries . values ( ) )
76
70
: [ ] ;
77
71
markerInstance . transitions . forEach ( transition => {
78
72
onMarkerProgress (
@@ -88,16 +82,17 @@ export function processTransitionCallbacks(
88
82
}
89
83
90
84
const markerComplete = pendingTransitions . markerComplete ;
91
- if ( markerComplete !== null ) {
92
- markerComplete . forEach ( marker => {
93
- if ( callbacks . onMarkerComplete != null ) {
94
- callbacks . onMarkerComplete (
95
- marker . transition . name ,
96
- marker . name ,
97
- marker . transition . startTime ,
85
+ const onMarkerComplete = callbacks . onMarkerComplete ;
86
+ if ( markerComplete !== null && onMarkerComplete != null ) {
87
+ markerComplete . forEach ( ( transitions , markerName ) => {
88
+ transitions . forEach ( transition => {
89
+ onMarkerComplete (
90
+ transition . name ,
91
+ markerName ,
92
+ transition . startTime ,
98
93
endTime ,
99
94
) ;
100
- }
95
+ } ) ;
101
96
} ) ;
102
97
}
103
98
@@ -115,16 +110,11 @@ export function processTransitionCallbacks(
115
110
}
116
111
117
112
const transitionComplete = pendingTransitions . transitionComplete ;
118
- if ( transitionComplete !== null ) {
119
- transitionComplete . forEach ( transition => {
120
- if ( callbacks . onTransitionComplete != null ) {
121
- callbacks . onTransitionComplete (
122
- transition . name ,
123
- transition . startTime ,
124
- endTime ,
125
- ) ;
126
- }
127
- } ) ;
113
+ const onTransitionComplete = callbacks . onTransitionComplete ;
114
+ if ( transitionComplete !== null && onTransitionComplete != null ) {
115
+ transitionComplete . forEach ( transition =>
116
+ onTransitionComplete ( transition . name , transition . startTime , endTime ) ,
117
+ ) ;
128
118
}
129
119
}
130
120
}
@@ -157,7 +147,7 @@ export function pushRootMarkerInstance(workInProgress: Fiber): void {
157
147
if ( ! root . incompleteTransitions . has ( transition ) ) {
158
148
const markerInstance : TracingMarkerInstance = {
159
149
transitions : new Set ( [ transition ] ) ,
160
- pendingSuspenseBoundaries : null ,
150
+ pendingBoundaries : null ,
161
151
} ;
162
152
root . incompleteTransitions . set ( transition , markerInstance ) ;
163
153
}
0 commit comments