Skip to content

Commit 15da917

Browse files
authored
Don't read currentTransition back from internals (#30991)
This code is weird. It reads back the transition that it just set from the shared internals. It's almost like it expects it to be a getter or something. This avoids that and makes it consistent with what ReactFiberHooks already does.
1 parent 4549be0 commit 15da917

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/react/src/ReactStartTransition.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,17 @@ export function startTransition(
2323
options?: StartTransitionOptions,
2424
) {
2525
const prevTransition = ReactSharedInternals.T;
26-
const transition: BatchConfigTransition = {};
27-
ReactSharedInternals.T = transition;
28-
const currentTransition = ReactSharedInternals.T;
26+
const currentTransition: BatchConfigTransition = {};
27+
ReactSharedInternals.T = currentTransition;
2928

3029
if (__DEV__) {
31-
ReactSharedInternals.T._updatedFibers = new Set();
30+
currentTransition._updatedFibers = new Set();
3231
}
3332

3433
if (enableTransitionTracing) {
3534
if (options !== undefined && options.name !== undefined) {
36-
// $FlowFixMe[incompatible-use] found when upgrading Flow
37-
ReactSharedInternals.T.name = options.name;
38-
// $FlowFixMe[incompatible-use] found when upgrading Flow
39-
ReactSharedInternals.T.startTime = -1;
35+
currentTransition.name = options.name;
36+
currentTransition.startTime = -1;
4037
}
4138
}
4239

@@ -45,7 +42,7 @@ export function startTransition(
4542
const returnValue = scope();
4643
const onStartTransitionFinish = ReactSharedInternals.S;
4744
if (onStartTransitionFinish !== null) {
48-
onStartTransitionFinish(transition, returnValue);
45+
onStartTransitionFinish(currentTransition, returnValue);
4946
}
5047
if (
5148
typeof returnValue === 'object' &&

0 commit comments

Comments
 (0)