Skip to content

Commit 11ed701

Browse files
authored
[Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions (facebook#24885)
This PR adds the `onMarkerIncomplete` callback for tracing marker name changes. Specifically, this PR: * Adds the `onMarkerIncomplete` callback * When a tracing marker is deleted, call `onMarkerIncomplete` with the `name` of the tracing marker for the tracing marker. * When a tracing marker/suspense boundary is deleted, call `onMarkerIncomplete` for every parent tracing marker with the `name` of the tracing marker that caused the transition to be incomplete. * Don't call `onTransitionComplete` or `onMarkerComplete` when `onMarkerIncomplete` is called for all tracing markers with the same transitions, but continue to call `onTransitionProgress`
1 parent b798942 commit 11ed701

14 files changed

+1571
-106
lines changed

packages/react-reconciler/src/ReactFiber.new.js

+2
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,8 @@ export function createFiberFromTracingMarker(
774774
tag: TransitionTracingMarker,
775775
transitions: null,
776776
pendingBoundaries: null,
777+
aborts: null,
778+
name: pendingProps.name,
777779
};
778780
fiber.stateNode = tracingMarkerInstance;
779781
return fiber;

packages/react-reconciler/src/ReactFiber.old.js

+2
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,8 @@ export function createFiberFromTracingMarker(
774774
tag: TransitionTracingMarker,
775775
transitions: null,
776776
pendingBoundaries: null,
777+
aborts: null,
778+
name: pendingProps.name,
777779
};
778780
fiber.stateNode = tracingMarkerInstance;
779781
return fiber;

packages/react-reconciler/src/ReactFiberBeginWork.new.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
StaticMask,
9090
ShouldCapture,
9191
ForceClientRender,
92+
Passive,
9293
} from './ReactFiberFlags';
9394
import ReactSharedInternals from 'shared/ReactSharedInternals';
9495
import {
@@ -979,10 +980,17 @@ function updateTracingMarkerComponent(
979980
const markerInstance: TracingMarkerInstance = {
980981
tag: TransitionTracingMarker,
981982
transitions: new Set(currentTransitions),
982-
pendingBoundaries: new Map(),
983+
pendingBoundaries: null,
983984
name: workInProgress.pendingProps.name,
985+
aborts: null,
984986
};
985987
workInProgress.stateNode = markerInstance;
988+
989+
// We call the marker complete callback when all child suspense boundaries resolve.
990+
// We do this in the commit phase on Offscreen. If the marker has no child suspense
991+
// boundaries, we need to schedule a passive effect to make sure we call the marker
992+
// complete callback.
993+
workInProgress.flags |= Passive;
986994
}
987995
} else {
988996
if (__DEV__) {

packages/react-reconciler/src/ReactFiberBeginWork.old.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
StaticMask,
9090
ShouldCapture,
9191
ForceClientRender,
92+
Passive,
9293
} from './ReactFiberFlags';
9394
import ReactSharedInternals from 'shared/ReactSharedInternals';
9495
import {
@@ -979,10 +980,17 @@ function updateTracingMarkerComponent(
979980
const markerInstance: TracingMarkerInstance = {
980981
tag: TransitionTracingMarker,
981982
transitions: new Set(currentTransitions),
982-
pendingBoundaries: new Map(),
983+
pendingBoundaries: null,
983984
name: workInProgress.pendingProps.name,
985+
aborts: null,
984986
};
985987
workInProgress.stateNode = markerInstance;
988+
989+
// We call the marker complete callback when all child suspense boundaries resolve.
990+
// We do this in the commit phase on Offscreen. If the marker has no child suspense
991+
// boundaries, we need to schedule a passive effect to make sure we call the marker
992+
// complete callback.
993+
workInProgress.flags |= Passive;
986994
}
987995
} else {
988996
if (__DEV__) {

0 commit comments

Comments
 (0)