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

Changed the Transitions type to Array<Transition> because Transitions was confusing
This commit is contained in:
Luna Ruan
2022-04-01 17:02:28 -04:00
committed by GitHub
parent c89a15c716
commit b8cfda15e1
9 changed files with 14 additions and 24 deletions
@@ -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<Transition> | null {
if (!enableTransitionTracing) {
return null;
}
@@ -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<Transition> | null {
if (!enableTransitionTracing) {
return null;
}
@@ -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<Transition> | null,
};
function FiberRootNode(
@@ -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<Transition> | null,
};
function FiberRootNode(
@@ -34,8 +34,6 @@ export type BatchConfigTransition = {
_updatedFibers?: Set<Fiber>,
};
export type Transitions = Array<Transition> | null;
export type TransitionCallback = 0 | 1;
export const TransitionStart = 0;
@@ -34,8 +34,6 @@ export type BatchConfigTransition = {
_updatedFibers?: Set<Fiber>,
};
export type Transitions = Array<Transition> | null;
export type TransitionCallback = 0 | 1;
export const TransitionStart = 0;
@@ -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<Transition> | null = null;
export function getWorkInProgressTransitions() {
return workInProgressTransitions;
}
@@ -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<Transition> | null = null;
export function getWorkInProgressTransitions() {
return workInProgressTransitions;
}
+2 -2
View File
@@ -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<Transitions>,
transitionLanes: Array<Array<Transition> | null>,
|};
// Exported FiberRoot type includes all properties,