@@ -401,9 +401,14 @@ export function requestUpdateLane(fiber: Fiber): Lane {
401
401
if (
402
402
__DEV__ &&
403
403
warnOnSubscriptionInsideStartTransition &&
404
- ReactCurrentBatchConfig . _updatedFibers
404
+ ReactCurrentBatchConfig . transition !== null
405
405
) {
406
- ReactCurrentBatchConfig . _updatedFibers . add ( fiber ) ;
406
+ const transition = ReactCurrentBatchConfig . transition ;
407
+ if ( ! transition . _updatedFibers ) {
408
+ transition . _updatedFibers = new Set ( ) ;
409
+ }
410
+
411
+ transition._updatedFibers.add(fiber);
407
412
}
408
413
// The algorithm for assigning an update to a lane should be stable for all
409
414
// updates at the same priority within the same event. To do this, the
@@ -1246,7 +1251,7 @@ export function deferredUpdates<A>(fn: () => A): A {
1246
1251
const previousPriority = getCurrentUpdatePriority ( ) ;
1247
1252
const prevTransition = ReactCurrentBatchConfig . transition ;
1248
1253
try {
1249
- ReactCurrentBatchConfig. transition = 0 ;
1254
+ ReactCurrentBatchConfig. transition = null ;
1250
1255
setCurrentUpdatePriority ( DefaultEventPriority ) ;
1251
1256
return fn ( ) ;
1252
1257
} finally {
@@ -1285,7 +1290,7 @@ export function discreteUpdates<A, B, C, D, R>(
1285
1290
const previousPriority = getCurrentUpdatePriority ( ) ;
1286
1291
const prevTransition = ReactCurrentBatchConfig . transition ;
1287
1292
try {
1288
- ReactCurrentBatchConfig . transition = 0 ;
1293
+ ReactCurrentBatchConfig . transition = null ;
1289
1294
setCurrentUpdatePriority ( DiscreteEventPriority ) ;
1290
1295
return fn ( a , b , c , d ) ;
1291
1296
} finally {
@@ -1320,7 +1325,7 @@ export function flushSync(fn) {
1320
1325
const prevTransition = ReactCurrentBatchConfig.transition;
1321
1326
const previousPriority = getCurrentUpdatePriority();
1322
1327
try {
1323
- ReactCurrentBatchConfig . transition = 0 ;
1328
+ ReactCurrentBatchConfig . transition = null ;
1324
1329
setCurrentUpdatePriority ( DiscreteEventPriority ) ;
1325
1330
if ( fn ) {
1326
1331
return fn ( ) ;
@@ -1355,7 +1360,7 @@ export function flushControlled(fn: () => mixed): void {
1355
1360
const prevTransition = ReactCurrentBatchConfig . transition ;
1356
1361
const previousPriority = getCurrentUpdatePriority ( ) ;
1357
1362
try {
1358
- ReactCurrentBatchConfig. transition = 0 ;
1363
+ ReactCurrentBatchConfig. transition = null ;
1359
1364
setCurrentUpdatePriority ( DiscreteEventPriority ) ;
1360
1365
fn ( ) ;
1361
1366
} finally {
@@ -1893,7 +1898,7 @@ function commitRoot(root: FiberRoot, recoverableErrors: null | Array<mixed>) {
1893
1898
const previousUpdateLanePriority = getCurrentUpdatePriority ( ) ;
1894
1899
const prevTransition = ReactCurrentBatchConfig . transition ;
1895
1900
try {
1896
- ReactCurrentBatchConfig. transition = 0 ;
1901
+ ReactCurrentBatchConfig. transition = null ;
1897
1902
setCurrentUpdatePriority ( DiscreteEventPriority ) ;
1898
1903
commitRootImpl ( root , recoverableErrors , previousUpdateLanePriority ) ;
1899
1904
} finally {
@@ -2028,7 +2033,7 @@ function commitRootImpl(
2028
2033
2029
2034
if ( subtreeHasEffects || rootHasEffect ) {
2030
2035
const prevTransition = ReactCurrentBatchConfig . transition ;
2031
- ReactCurrentBatchConfig . transition = 0 ;
2036
+ ReactCurrentBatchConfig . transition = null ;
2032
2037
const previousPriority = getCurrentUpdatePriority ( ) ;
2033
2038
setCurrentUpdatePriority ( DiscreteEventPriority ) ;
2034
2039
@@ -2283,7 +2288,7 @@ export function flushPassiveEffects(): boolean {
2283
2288
const prevTransition = ReactCurrentBatchConfig . transition ;
2284
2289
const previousPriority = getCurrentUpdatePriority ( ) ;
2285
2290
try {
2286
- ReactCurrentBatchConfig . transition = 0 ;
2291
+ ReactCurrentBatchConfig . transition = null ;
2287
2292
setCurrentUpdatePriority ( priority ) ;
2288
2293
return flushPassiveEffectsImpl ( ) ;
2289
2294
} finally {
0 commit comments