@samitouri / QOS-React / commits / b8cfda15e1

changed Transitions type to Array<Transition> (#24249)

Changed the Transitions type to Array<Transition> because Transitions was confusing

Luna Ruan committed Apr 1, 2022 at 17:02 UTC b8cfda15e1232554487c7285fb464f22705a23ce
9 files changed +14 -24
packages/react-reconciler/src/ReactFiberLane.new.js
+2 -5
@@ -8,10 +8,7 @@
8 */
9
10 import type {FiberRoot} from './ReactInternalTypes';
11 -import type {
12 - Transition,
13 - Transitions,
14 -} from './ReactFiberTracingMarkerComponent.new';
11 +import type {Transition} from './ReactFiberTracingMarkerComponent.new';
12
13 // TODO: Ideally these types would be opaque but that doesn't work well with
14 // our reconciler fork infra, since these leak into non-reconciler packages.
@@ -824,7 +821,7 @@ export function addTransitionToLanesMap(
821 export function getTransitionsForLanes(
822 root: FiberRoot,
823 lanes: Lane | Lanes,
827 -): Transitions | null {
824 +): Array<Transition> | null {
825 if (!enableTransitionTracing) {
826 return null;
827 }
packages/react-reconciler/src/ReactFiberLane.old.js
+2 -5
@@ -8,10 +8,7 @@
8 */
9
10 import type {FiberRoot} from './ReactInternalTypes';
11 -import type {
12 - Transition,
13 - Transitions,
14 -} from './ReactFiberTracingMarkerComponent.old';
11 +import type {Transition} from './ReactFiberTracingMarkerComponent.old';
12
13 // TODO: Ideally these types would be opaque but that doesn't work well with
14 // our reconciler fork infra, since these leak into non-reconciler packages.
@@ -824,7 +821,7 @@ export function addTransitionToLanesMap(
821 export function getTransitionsForLanes(
822 root: FiberRoot,
823 lanes: Lane | Lanes,
827 -): Transitions | null {
824 +): Array<Transition> | null {
825 if (!enableTransitionTracing) {
826 return null;
827 }
packages/react-reconciler/src/ReactFiberRoot.new.js
+2 -2
@@ -15,7 +15,7 @@ import type {
15 } from './ReactInternalTypes';
16 import type {RootTag} from './ReactRootTags';
17 import type {Cache} from './ReactFiberCacheComponent.new';
18 -import type {Transitions} from './ReactFiberTracingMarkerComponent.new';
18 +import type {Transition} from './ReactFiberTracingMarkerComponent.new';
19
20 import {noTimeout, supportsHydration} from './ReactFiberHostConfig';
21 import {createHostRootFiber} from './ReactFiber.new';
@@ -42,7 +42,7 @@ export type RootState = {
42 element: any,
43 isDehydrated: boolean,
44 cache: Cache,
45 - transitions: Transitions | null,
45 + transitions: Array<Transition> | null,
46 };
47
48 function FiberRootNode(
packages/react-reconciler/src/ReactFiberRoot.old.js
+2 -2
@@ -15,7 +15,7 @@ import type {
15 } from './ReactInternalTypes';
16 import type {RootTag} from './ReactRootTags';
17 import type {Cache} from './ReactFiberCacheComponent.old';
18 -import type {Transitions} from './ReactFiberTracingMarkerComponent.old';
18 +import type {Transition} from './ReactFiberTracingMarkerComponent.old';
19
20 import {noTimeout, supportsHydration} from './ReactFiberHostConfig';
21 import {createHostRootFiber} from './ReactFiber.old';
@@ -42,7 +42,7 @@ export type RootState = {
42 element: any,
43 isDehydrated: boolean,
44 cache: Cache,
45 - transitions: Transitions | null,
45 + transitions: Array<Transition> | null,
46 };
47
48 function FiberRootNode(
packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js
-2
@@ -34,8 +34,6 @@ export type BatchConfigTransition = {
34 _updatedFibers?: Set<Fiber>,
35 };
36
37 -export type Transitions = Array<Transition> | null;
38 -
37 export type TransitionCallback = 0 | 1;
38
39 export const TransitionStart = 0;
packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js
-2
@@ -34,8 +34,6 @@ export type BatchConfigTransition = {
34 _updatedFibers?: Set<Fiber>,
35 };
36
37 -export type Transitions = Array<Transition> | null;
38 -
37 export type TransitionCallback = 0 | 1;
38
39 export const TransitionStart = 0;
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+2 -2
@@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.new';
18 import type {
19 PendingTransitionCallbacks,
20 TransitionObject,
21 - Transitions,
21 + Transition,
22 } from './ReactFiberTracingMarkerComponent.new';
23
24 import {
@@ -325,7 +325,7 @@ let workInProgressRootRenderTargetTime: number = Infinity;
325 // suspense heuristics and opt out of rendering more content.
326 const RENDER_TIMEOUT_MS = 500;
327
328 -let workInProgressTransitions: Transitions | null = null;
328 +let workInProgressTransitions: Array<Transition> | null = null;
329 export function getWorkInProgressTransitions() {
330 return workInProgressTransitions;
331 }
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+2 -2
@@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.old';
18 import type {
19 PendingTransitionCallbacks,
20 TransitionObject,
21 - Transitions,
21 + Transition,
22 } from './ReactFiberTracingMarkerComponent.old';
23
24 import {
@@ -325,7 +325,7 @@ let workInProgressRootRenderTargetTime: number = Infinity;
325 // suspense heuristics and opt out of rendering more content.
326 const RENDER_TIMEOUT_MS = 500;
327
328 -let workInProgressTransitions: Transitions | null = null;
328 +let workInProgressTransitions: Array<Transition> | null = null;
329 export function getWorkInProgressTransitions() {
330 return workInProgressTransitions;
331 }
packages/react-reconciler/src/ReactInternalTypes.js
+2 -2
@@ -26,7 +26,7 @@ import type {Lane, Lanes, LaneMap} from './ReactFiberLane.old';
26 import type {RootTag} from './ReactRootTags';
27 import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig';
28 import type {Cache} from './ReactFiberCacheComponent.old';
29 -import type {Transitions} from './ReactFiberTracingMarkerComponent.new';
29 +import type {Transition} from './ReactFiberTracingMarkerComponent.new';
30
31 // Unwind Circular: moved from ReactFiberHooks.old
32 export type HookType =
@@ -320,7 +320,7 @@ export type TransitionTracingCallbacks = {
320 // The following fields are only used in transition tracing in Profile builds
321 type TransitionTracingOnlyFiberRootProperties = {|
322 transitionCallbacks: null | TransitionTracingCallbacks,
323 - transitionLanes: Array<Transitions>,
323 + transitionLanes: Array<Array<Transition> | null>,
324 |};
325
326 // Exported FiberRoot type includes all properties,