From 15f41f4015f688d7f305ca3cf545e5aa2c3a0b7b Mon Sep 17 00:00:00 2001 From: Luna Ruan Date: Fri, 1 Apr 2022 17:02:28 -0400 Subject: [PATCH] changed Transitions type to Array (#24249) Changed the Transitions type to Array because Transitions was confusing --- packages/react-reconciler/src/ReactFiberLane.new.js | 7 ++----- packages/react-reconciler/src/ReactFiberLane.old.js | 7 ++----- packages/react-reconciler/src/ReactFiberRoot.new.js | 4 ++-- packages/react-reconciler/src/ReactFiberRoot.old.js | 4 ++-- .../src/ReactFiberTracingMarkerComponent.new.js | 2 -- .../src/ReactFiberTracingMarkerComponent.old.js | 2 -- packages/react-reconciler/src/ReactFiberWorkLoop.new.js | 4 ++-- packages/react-reconciler/src/ReactFiberWorkLoop.old.js | 4 ++-- packages/react-reconciler/src/ReactInternalTypes.js | 4 ++-- 9 files changed, 14 insertions(+), 24 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberLane.new.js b/packages/react-reconciler/src/ReactFiberLane.new.js index 3bf65a9093add..4013545caf8d5 100644 --- a/packages/react-reconciler/src/ReactFiberLane.new.js +++ b/packages/react-reconciler/src/ReactFiberLane.new.js @@ -8,10 +8,7 @@ */ import type {FiberRoot} from './ReactInternalTypes'; -import type { - Transition, - Transitions, -} from './ReactFiberTracingMarkerComponent.new'; +import type {Transition} from './ReactFiberTracingMarkerComponent.new'; // TODO: Ideally these types would be opaque but that doesn't work well with // our reconciler fork infra, since these leak into non-reconciler packages. @@ -824,7 +821,7 @@ export function addTransitionToLanesMap( export function getTransitionsForLanes( root: FiberRoot, lanes: Lane | Lanes, -): Transitions | null { +): Array | null { if (!enableTransitionTracing) { return null; } diff --git a/packages/react-reconciler/src/ReactFiberLane.old.js b/packages/react-reconciler/src/ReactFiberLane.old.js index ec884de182ff6..37fb44cc10867 100644 --- a/packages/react-reconciler/src/ReactFiberLane.old.js +++ b/packages/react-reconciler/src/ReactFiberLane.old.js @@ -8,10 +8,7 @@ */ import type {FiberRoot} from './ReactInternalTypes'; -import type { - Transition, - Transitions, -} from './ReactFiberTracingMarkerComponent.old'; +import type {Transition} from './ReactFiberTracingMarkerComponent.old'; // TODO: Ideally these types would be opaque but that doesn't work well with // our reconciler fork infra, since these leak into non-reconciler packages. @@ -824,7 +821,7 @@ export function addTransitionToLanesMap( export function getTransitionsForLanes( root: FiberRoot, lanes: Lane | Lanes, -): Transitions | null { +): Array | null { if (!enableTransitionTracing) { return null; } diff --git a/packages/react-reconciler/src/ReactFiberRoot.new.js b/packages/react-reconciler/src/ReactFiberRoot.new.js index 7ff03ceead0e3..ba8717a65e9e8 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.new.js +++ b/packages/react-reconciler/src/ReactFiberRoot.new.js @@ -15,7 +15,7 @@ import type { } from './ReactInternalTypes'; import type {RootTag} from './ReactRootTags'; import type {Cache} from './ReactFiberCacheComponent.new'; -import type {Transitions} from './ReactFiberTracingMarkerComponent.new'; +import type {Transition} from './ReactFiberTracingMarkerComponent.new'; import {noTimeout, supportsHydration} from './ReactFiberHostConfig'; import {createHostRootFiber} from './ReactFiber.new'; @@ -42,7 +42,7 @@ export type RootState = { element: any, isDehydrated: boolean, cache: Cache, - transitions: Transitions | null, + transitions: Array | null, }; function FiberRootNode( diff --git a/packages/react-reconciler/src/ReactFiberRoot.old.js b/packages/react-reconciler/src/ReactFiberRoot.old.js index 179b9c17ae416..1d5edd410cfef 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.old.js +++ b/packages/react-reconciler/src/ReactFiberRoot.old.js @@ -15,7 +15,7 @@ import type { } from './ReactInternalTypes'; import type {RootTag} from './ReactRootTags'; import type {Cache} from './ReactFiberCacheComponent.old'; -import type {Transitions} from './ReactFiberTracingMarkerComponent.old'; +import type {Transition} from './ReactFiberTracingMarkerComponent.old'; import {noTimeout, supportsHydration} from './ReactFiberHostConfig'; import {createHostRootFiber} from './ReactFiber.old'; @@ -42,7 +42,7 @@ export type RootState = { element: any, isDehydrated: boolean, cache: Cache, - transitions: Transitions | null, + transitions: Array | null, }; function FiberRootNode( diff --git a/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js b/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js index aad0c912c5318..cc3834f5cc6c3 100644 --- a/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js +++ b/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js @@ -34,8 +34,6 @@ export type BatchConfigTransition = { _updatedFibers?: Set, }; -export type Transitions = Array | null; - export type TransitionCallback = 0 | 1; export const TransitionStart = 0; diff --git a/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js b/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js index aad0c912c5318..cc3834f5cc6c3 100644 --- a/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js +++ b/packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js @@ -34,8 +34,6 @@ export type BatchConfigTransition = { _updatedFibers?: Set, }; -export type Transitions = Array | null; - export type TransitionCallback = 0 | 1; export const TransitionStart = 0; diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 3e50d6e391608..4da17c7bb6e80 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.new'; import type { PendingTransitionCallbacks, TransitionObject, - Transitions, + Transition, } from './ReactFiberTracingMarkerComponent.new'; import { @@ -325,7 +325,7 @@ let workInProgressRootRenderTargetTime: number = Infinity; // suspense heuristics and opt out of rendering more content. const RENDER_TIMEOUT_MS = 500; -let workInProgressTransitions: Transitions | null = null; +let workInProgressTransitions: Array | null = null; export function getWorkInProgressTransitions() { return workInProgressTransitions; } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index 2745bb87c09eb..2c940a71001db 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.old'; import type { PendingTransitionCallbacks, TransitionObject, - Transitions, + Transition, } from './ReactFiberTracingMarkerComponent.old'; import { @@ -325,7 +325,7 @@ let workInProgressRootRenderTargetTime: number = Infinity; // suspense heuristics and opt out of rendering more content. const RENDER_TIMEOUT_MS = 500; -let workInProgressTransitions: Transitions | null = null; +let workInProgressTransitions: Array | null = null; export function getWorkInProgressTransitions() { return workInProgressTransitions; } diff --git a/packages/react-reconciler/src/ReactInternalTypes.js b/packages/react-reconciler/src/ReactInternalTypes.js index 1fa3d4b6680d1..319bbc1c337dd 100644 --- a/packages/react-reconciler/src/ReactInternalTypes.js +++ b/packages/react-reconciler/src/ReactInternalTypes.js @@ -26,7 +26,7 @@ import type {Lane, Lanes, LaneMap} from './ReactFiberLane.old'; import type {RootTag} from './ReactRootTags'; import type {TimeoutHandle, NoTimeout} from './ReactFiberHostConfig'; import type {Cache} from './ReactFiberCacheComponent.old'; -import type {Transitions} from './ReactFiberTracingMarkerComponent.new'; +import type {Transition} from './ReactFiberTracingMarkerComponent.new'; // Unwind Circular: moved from ReactFiberHooks.old export type HookType = @@ -320,7 +320,7 @@ export type TransitionTracingCallbacks = { // The following fields are only used in transition tracing in Profile builds type TransitionTracingOnlyFiberRootProperties = {| transitionCallbacks: null | TransitionTracingCallbacks, - transitionLanes: Array, + transitionLanes: Array | null>, |}; // Exported FiberRoot type includes all properties,