@@ -162,17 +162,11 @@ describe('ReactIncrementalUpdates', () => {
162
162
}
163
163
164
164
// Schedule some async updates
165
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
166
- React . startTransition ( ( ) => {
167
- instance . setState ( createUpdate ( 'a' ) ) ;
168
- instance . setState ( createUpdate ( 'b' ) ) ;
169
- instance . setState ( createUpdate ( 'c' ) ) ;
170
- } ) ;
171
- } else {
165
+ React . startTransition ( ( ) => {
172
166
instance . setState ( createUpdate ( 'a' ) ) ;
173
167
instance . setState ( createUpdate ( 'b' ) ) ;
174
168
instance . setState ( createUpdate ( 'c' ) ) ;
175
- }
169
+ } ) ;
176
170
177
171
// Begin the updates but don't flush them yet
178
172
expect ( Scheduler ) . toFlushAndYieldThrough ( [ 'a' , 'b' , 'c' ] ) ;
@@ -189,14 +183,8 @@ describe('ReactIncrementalUpdates', () => {
189
183
} ) ;
190
184
191
185
// The sync updates should have flushed, but not the async ones.
192
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
193
- expect ( Scheduler ) . toHaveYielded ( [ 'd' , 'e' , 'f' ] ) ;
194
- expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'def' ) ] ) ;
195
- } else {
196
- // Update d was dropped and replaced by e.
197
- expect ( Scheduler ) . toHaveYielded ( [ 'e' , 'f' ] ) ;
198
- expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'ef' ) ] ) ;
199
- }
186
+ expect ( Scheduler ) . toHaveYielded ( [ 'd' , 'e' , 'f' ] ) ;
187
+ expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'def' ) ] ) ;
200
188
201
189
// Now flush the remaining work. Even though e and f were already processed,
202
190
// they should be processed again, to ensure that the terminal state
@@ -245,17 +233,11 @@ describe('ReactIncrementalUpdates', () => {
245
233
}
246
234
247
235
// Schedule some async updates
248
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
249
- React . startTransition ( ( ) => {
250
- instance . setState ( createUpdate ( 'a' ) ) ;
251
- instance . setState ( createUpdate ( 'b' ) ) ;
252
- instance . setState ( createUpdate ( 'c' ) ) ;
253
- } ) ;
254
- } else {
236
+ React . startTransition ( ( ) => {
255
237
instance . setState ( createUpdate ( 'a' ) ) ;
256
238
instance . setState ( createUpdate ( 'b' ) ) ;
257
239
instance . setState ( createUpdate ( 'c' ) ) ;
258
- }
240
+ } ) ;
259
241
260
242
// Begin the updates but don't flush them yet
261
243
expect ( Scheduler ) . toFlushAndYieldThrough ( [ 'a' , 'b' , 'c' ] ) ;
@@ -275,18 +257,22 @@ describe('ReactIncrementalUpdates', () => {
275
257
} ) ;
276
258
277
259
// The sync updates should have flushed, but not the async ones.
278
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
279
- expect ( Scheduler ) . toHaveYielded ( [ 'd' , 'e' , 'f' ] ) ;
280
- } else {
281
- // Update d was dropped and replaced by e.
282
- expect ( Scheduler ) . toHaveYielded ( [ 'e' , 'f' ] ) ;
283
- }
260
+ expect ( Scheduler ) . toHaveYielded ( [ 'd' , 'e' , 'f' ] ) ;
284
261
expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'f' ) ] ) ;
285
262
286
263
// Now flush the remaining work. Even though e and f were already processed,
287
264
// they should be processed again, to ensure that the terminal state
288
265
// is deterministic.
289
- expect ( Scheduler ) . toFlushAndYield ( [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' ] ) ;
266
+ expect ( Scheduler ) . toFlushAndYield ( [
267
+ // Then we'll re-process everything for 'g'.
268
+ 'a' ,
269
+ 'b' ,
270
+ 'c' ,
271
+ 'd' ,
272
+ 'e' ,
273
+ 'f' ,
274
+ 'g' ,
275
+ ] ) ;
290
276
expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'fg' ) ] ) ;
291
277
} ) ;
292
278
@@ -629,14 +615,9 @@ describe('ReactIncrementalUpdates', () => {
629
615
expect ( root ) . toMatchRenderedOutput ( null ) ;
630
616
631
617
await act ( async ( ) => {
632
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
633
- React . startTransition ( ( ) => {
634
- pushToLog ( 'A' ) ;
635
- } ) ;
636
- } else {
618
+ React . startTransition ( ( ) => {
637
619
pushToLog ( 'A' ) ;
638
- }
639
-
620
+ } ) ;
640
621
ReactNoop . unstable_runWithPriority ( ContinuousEventPriority , ( ) =>
641
622
pushToLog ( 'B' ) ,
642
623
) ;
@@ -688,13 +669,9 @@ describe('ReactIncrementalUpdates', () => {
688
669
expect ( root ) . toMatchRenderedOutput ( null ) ;
689
670
690
671
await act ( async ( ) => {
691
- if ( gate ( flags => flags . enableSyncDefaultUpdates ) ) {
692
- React . startTransition ( ( ) => {
693
- pushToLog ( 'A' ) ;
694
- } ) ;
695
- } else {
672
+ React . startTransition ( ( ) => {
696
673
pushToLog ( 'A' ) ;
697
- }
674
+ } ) ;
698
675
ReactNoop . unstable_runWithPriority ( ContinuousEventPriority , ( ) =>
699
676
pushToLog ( 'B' ) ,
700
677
) ;
0 commit comments