Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Transition Tracing] Change Transition Type Passed Pending Transitions #24856

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions packages/react-reconciler/src/ReactFiberCommitWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2816,10 +2816,7 @@ function commitPassiveMountOnFiber(
// Initial render
if (committedTransitions !== null) {
committedTransitions.forEach(transition => {
addTransitionStartCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
});
addTransitionStartCallbackToPendingTransition(transition);
});

clearTransitionsForLanes(finishedRoot, committedLanes);
Expand All @@ -2831,10 +2828,7 @@ function commitPassiveMountOnFiber(
pendingSuspenseBoundaries === null ||
pendingSuspenseBoundaries.size === 0
) {
addTransitionCompleteCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
});
addTransitionCompleteCallbackToPendingTransition(transition);
incompleteTransitions.delete(transition);
}
},
Expand Down Expand Up @@ -2981,9 +2975,8 @@ function commitPassiveMountOnFiber(
) {
instance.transitions.forEach(transition => {
addMarkerCompleteCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
markerName: finishedWork.memoizedProps.name,
transition,
name: finishedWork.memoizedProps.name,
});
});
instance.transitions = null;
Expand Down
15 changes: 4 additions & 11 deletions packages/react-reconciler/src/ReactFiberCommitWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2816,10 +2816,7 @@ function commitPassiveMountOnFiber(
// Initial render
if (committedTransitions !== null) {
committedTransitions.forEach(transition => {
addTransitionStartCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
});
addTransitionStartCallbackToPendingTransition(transition);
});

clearTransitionsForLanes(finishedRoot, committedLanes);
Expand All @@ -2831,10 +2828,7 @@ function commitPassiveMountOnFiber(
pendingSuspenseBoundaries === null ||
pendingSuspenseBoundaries.size === 0
) {
addTransitionCompleteCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
});
addTransitionCompleteCallbackToPendingTransition(transition);
incompleteTransitions.delete(transition);
}
},
Expand Down Expand Up @@ -2981,9 +2975,8 @@ function commitPassiveMountOnFiber(
) {
instance.transitions.forEach(transition => {
addMarkerCompleteCallbackToPendingTransition({
transitionName: transition.name,
startTime: transition.startTime,
markerName: finishedWork.memoizedProps.name,
transition,
name: finishedWork.memoizedProps.name,
});
});
instance.transitions = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ import {getWorkInProgressTransitions} from './ReactFiberWorkLoop.new';

export type SuspenseInfo = {name: string | null};

export type TransitionObject = {
transitionName: string,
startTime: number,
export type MarkerTransition = {
transition: Transition,
name: string,
};

export type MarkerTransitionObject = TransitionObject & {markerName: string};
export type PendingTransitionCallbacks = {
transitionStart: Array<TransitionObject> | null,
transitionComplete: Array<TransitionObject> | null,
markerComplete: Array<MarkerTransitionObject> | null,
transitionStart: Array<Transition> | null,
transitionComplete: Array<Transition> | null,
markerComplete: Array<MarkerTransition> | null,
};

export type Transition = {
Expand Down Expand Up @@ -58,22 +57,19 @@ export function processTransitionCallbacks(
if (transitionStart !== null) {
transitionStart.forEach(transition => {
if (callbacks.onTransitionStart != null) {
callbacks.onTransitionStart(
transition.transitionName,
transition.startTime,
);
callbacks.onTransitionStart(transition.name, transition.startTime);
}
});
}

const markerComplete = pendingTransitions.markerComplete;
if (markerComplete !== null) {
markerComplete.forEach(transition => {
markerComplete.forEach(marker => {
if (callbacks.onMarkerComplete != null) {
callbacks.onMarkerComplete(
transition.transitionName,
transition.markerName,
transition.startTime,
marker.transition.name,
marker.name,
marker.transition.startTime,
endTime,
);
}
Expand All @@ -85,7 +81,7 @@ export function processTransitionCallbacks(
transitionComplete.forEach(transition => {
if (callbacks.onTransitionComplete != null) {
callbacks.onTransitionComplete(
transition.transitionName,
transition.name,
transition.startTime,
endTime,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ import {getWorkInProgressTransitions} from './ReactFiberWorkLoop.old';

export type SuspenseInfo = {name: string | null};

export type TransitionObject = {
transitionName: string,
startTime: number,
export type MarkerTransition = {
transition: Transition,
name: string,
};

export type MarkerTransitionObject = TransitionObject & {markerName: string};
export type PendingTransitionCallbacks = {
transitionStart: Array<TransitionObject> | null,
transitionComplete: Array<TransitionObject> | null,
markerComplete: Array<MarkerTransitionObject> | null,
transitionStart: Array<Transition> | null,
transitionComplete: Array<Transition> | null,
markerComplete: Array<MarkerTransition> | null,
};

export type Transition = {
Expand Down Expand Up @@ -58,22 +57,19 @@ export function processTransitionCallbacks(
if (transitionStart !== null) {
transitionStart.forEach(transition => {
if (callbacks.onTransitionStart != null) {
callbacks.onTransitionStart(
transition.transitionName,
transition.startTime,
);
callbacks.onTransitionStart(transition.name, transition.startTime);
}
});
}

const markerComplete = pendingTransitions.markerComplete;
if (markerComplete !== null) {
markerComplete.forEach(transition => {
markerComplete.forEach(marker => {
if (callbacks.onMarkerComplete != null) {
callbacks.onMarkerComplete(
transition.transitionName,
transition.markerName,
transition.startTime,
marker.transition.name,
marker.name,
marker.transition.startTime,
endTime,
);
}
Expand All @@ -85,7 +81,7 @@ export function processTransitionCallbacks(
transitionComplete.forEach(transition => {
if (callbacks.onTransitionComplete != null) {
callbacks.onTransitionComplete(
transition.transitionName,
transition.name,
transition.startTime,
endTime,
);
Expand Down
9 changes: 4 additions & 5 deletions packages/react-reconciler/src/ReactFiberWorkLoop.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import type {FunctionComponentUpdateQueue} from './ReactFiberHooks.new';
import type {EventPriority} from './ReactEventPriorities.new';
import type {
PendingTransitionCallbacks,
TransitionObject,
MarkerTransitionObject,
MarkerTransition,
Transition,
} from './ReactFiberTracingMarkerComponent.new';

Expand Down Expand Up @@ -332,7 +331,7 @@ export function getWorkInProgressTransitions() {
let currentPendingTransitionCallbacks: PendingTransitionCallbacks | null = null;

export function addTransitionStartCallbackToPendingTransition(
transition: TransitionObject,
transition: Transition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand All @@ -352,7 +351,7 @@ export function addTransitionStartCallbackToPendingTransition(
}

export function addMarkerCompleteCallbackToPendingTransition(
transition: MarkerTransitionObject,
transition: MarkerTransition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand All @@ -372,7 +371,7 @@ export function addMarkerCompleteCallbackToPendingTransition(
}

export function addTransitionCompleteCallbackToPendingTransition(
transition: TransitionObject,
transition: Transition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand Down
9 changes: 4 additions & 5 deletions packages/react-reconciler/src/ReactFiberWorkLoop.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import type {FunctionComponentUpdateQueue} from './ReactFiberHooks.old';
import type {EventPriority} from './ReactEventPriorities.old';
import type {
PendingTransitionCallbacks,
TransitionObject,
MarkerTransitionObject,
MarkerTransition,
Transition,
} from './ReactFiberTracingMarkerComponent.old';

Expand Down Expand Up @@ -344,7 +343,7 @@ export function getWorkInProgressTransitions() {
let currentPendingTransitionCallbacks: PendingTransitionCallbacks | null = null;

export function addTransitionStartCallbackToPendingTransition(
transition: TransitionObject,
transition: Transition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand All @@ -364,7 +363,7 @@ export function addTransitionStartCallbackToPendingTransition(
}

export function addMarkerCompleteCallbackToPendingTransition(
transition: MarkerTransitionObject,
transition: MarkerTransition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand All @@ -384,7 +383,7 @@ export function addMarkerCompleteCallbackToPendingTransition(
}

export function addTransitionCompleteCallbackToPendingTransition(
transition: TransitionObject,
transition: Transition,
) {
if (enableTransitionTracing) {
if (currentPendingTransitionCallbacks === null) {
Expand Down