@@ -12,6 +12,7 @@ import type {
12
12
Fiber ,
13
13
FiberRoot ,
14
14
} from './ReactInternalTypes' ;
15
+ import type { Transition } from 'react/src/ReactStartTransition' ;
15
16
import type { OffscreenInstance } from './ReactFiberActivityComponent' ;
16
17
import type { StackCursor } from './ReactFiberStack' ;
17
18
@@ -36,19 +37,6 @@ export type PendingTransitionCallbacks = {
36
37
markerComplete : Map < string , Set < Transition >> | null ,
37
38
} ;
38
39
39
- // TODO: Unclear to me why these are separate types
40
- export type Transition = {
41
- name : string ,
42
- startTime : number ,
43
- ...
44
- } ;
45
-
46
- export type BatchConfigTransition = {
47
- name ?: string ,
48
- startTime ?: number ,
49
- _updatedFibers ?: Set < Fiber > ,
50
- } ;
51
-
52
40
// TODO: Is there a way to not include the tag or name here?
53
41
export type TracingMarkerInstance = {
54
42
tag ?: TracingMarkerTag ,
@@ -79,9 +67,11 @@ export function processTransitionCallbacks(
79
67
const transitionStart = pendingTransitions . transitionStart ;
80
68
const onTransitionStart = callbacks . onTransitionStart ;
81
69
if ( transitionStart !== null && onTransitionStart != null ) {
82
- transitionStart . forEach ( transition =>
83
- onTransitionStart ( transition . name , transition . startTime ) ,
84
- ) ;
70
+ transitionStart . forEach ( transition => {
71
+ if ( transition . name != null ) {
72
+ onTransitionStart ( transition . name , transition . startTime ) ;
73
+ }
74
+ } ) ;
85
75
}
86
76
87
77
const markerProgress = pendingTransitions . markerProgress ;
@@ -95,13 +85,15 @@ export function processTransitionCallbacks(
95
85
? Array . from ( markerInstance . pendingBoundaries . values ( ) )
96
86
: [ ] ;
97
87
markerInstance . transitions . forEach ( transition => {
98
- onMarkerProgress (
99
- transition . name ,
100
- markerName ,
101
- transition . startTime ,
102
- endTime ,
103
- pending ,
104
- ) ;
88
+ if ( transition . name != null ) {
89
+ onMarkerProgress (
90
+ transition . name ,
91
+ markerName ,
92
+ transition . startTime ,
93
+ endTime ,
94
+ pending ,
95
+ ) ;
96
+ }
105
97
} ) ;
106
98
}
107
99
} ) ;
@@ -112,12 +104,14 @@ export function processTransitionCallbacks(
112
104
if ( markerComplete !== null && onMarkerComplete != null ) {
113
105
markerComplete . forEach ( ( transitions , markerName ) => {
114
106
transitions . forEach ( transition => {
115
- onMarkerComplete (
116
- transition . name ,
117
- markerName ,
118
- transition . startTime ,
119
- endTime ,
120
- ) ;
107
+ if ( transition . name != null ) {
108
+ onMarkerComplete (
109
+ transition . name ,
110
+ markerName ,
111
+ transition . startTime ,
112
+ endTime ,
113
+ ) ;
114
+ }
121
115
} ) ;
122
116
} ) ;
123
117
}
@@ -153,12 +147,14 @@ export function processTransitionCallbacks(
153
147
} ) ;
154
148
155
149
if ( filteredAborts . length > 0 ) {
156
- onMarkerIncomplete (
157
- transition . name ,
158
- markerName ,
159
- transition . startTime ,
160
- filteredAborts ,
161
- ) ;
150
+ if ( transition . name != null ) {
151
+ onMarkerIncomplete (
152
+ transition . name ,
153
+ markerName ,
154
+ transition . startTime ,
155
+ filteredAborts ,
156
+ ) ;
157
+ }
162
158
}
163
159
} ) ;
164
160
} ) ;
@@ -168,21 +164,29 @@ export function processTransitionCallbacks(
168
164
const onTransitionProgress = callbacks . onTransitionProgress ;
169
165
if ( onTransitionProgress != null && transitionProgress !== null ) {
170
166
transitionProgress . forEach ( ( pending , transition ) => {
171
- onTransitionProgress (
172
- transition . name ,
173
- transition . startTime ,
174
- endTime ,
175
- Array . from ( pending . values ( ) ) ,
176
- ) ;
167
+ if ( transition . name != null ) {
168
+ onTransitionProgress (
169
+ transition . name ,
170
+ transition . startTime ,
171
+ endTime ,
172
+ Array . from ( pending . values ( ) ) ,
173
+ ) ;
174
+ }
177
175
} ) ;
178
176
}
179
177
180
178
const transitionComplete = pendingTransitions . transitionComplete ;
181
179
const onTransitionComplete = callbacks . onTransitionComplete ;
182
180
if ( transitionComplete !== null && onTransitionComplete != null ) {
183
- transitionComplete . forEach ( transition =>
184
- onTransitionComplete ( transition . name , transition . startTime , endTime ) ,
185
- ) ;
181
+ transitionComplete . forEach ( transition => {
182
+ if ( transition . name != null ) {
183
+ onTransitionComplete (
184
+ transition . name ,
185
+ transition . startTime ,
186
+ endTime ,
187
+ ) ;
188
+ }
189
+ } ) ;
186
190
}
187
191
}
188
192
}
0 commit comments