Skip to content

Commit

Permalink
changed Transitions type to Array<Transition> (#24249)
Browse files Browse the repository at this point in the history
Changed the Transitions type to Array<Transition> because Transitions was confusing
  • Loading branch information
lunaruan authored Apr 1, 2022
1 parent c89a15c commit b8cfda1
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 24 deletions.
7 changes: 2 additions & 5 deletions packages/react-reconciler/src/ReactFiberLane.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -824,7 +821,7 @@ export function addTransitionToLanesMap(
export function getTransitionsForLanes(
root: FiberRoot,
lanes: Lane | Lanes,
): Transitions | null {
): Array<Transition> | null {
if (!enableTransitionTracing) {
return null;
}
Expand Down
7 changes: 2 additions & 5 deletions packages/react-reconciler/src/ReactFiberLane.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -824,7 +821,7 @@ export function addTransitionToLanesMap(
export function getTransitionsForLanes(
root: FiberRoot,
lanes: Lane | Lanes,
): Transitions | null {
): Array<Transition> | null {
if (!enableTransitionTracing) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberRoot.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -42,7 +42,7 @@ export type RootState = {
element: any,
isDehydrated: boolean,
cache: Cache,
transitions: Transitions | null,
transitions: Array<Transition> | null,
};

function FiberRootNode(
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberRoot.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -42,7 +42,7 @@ export type RootState = {
element: any,
isDehydrated: boolean,
cache: Cache,
transitions: Transitions | null,
transitions: Array<Transition> | null,
};

function FiberRootNode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberWorkLoop.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.new';
import type {
PendingTransitionCallbacks,
TransitionObject,
Transitions,
Transition,
} from './ReactFiberTracingMarkerComponent.new';

import {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberWorkLoop.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {EventPriority} from './ReactEventPriorities.old';
import type {
PendingTransitionCallbacks,
TransitionObject,
Transitions,
Transition,
} from './ReactFiberTracingMarkerComponent.old';

import {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactInternalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b8cfda1

Please sign in to comment.