Skip to content

Commit

Permalink
suspense boundary deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Aug 9, 2022
1 parent a4647fa commit 1fc184d
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 13 deletions.
27 changes: 20 additions & 7 deletions packages/react-reconciler/src/ReactFiberCommitWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2087,13 +2087,26 @@ function commitDeletionEffectsOnFiber(
if (enableTransitionTracing) {
// We need to mark this fiber's parents as deleted
const instance: OffscreenInstance = deletedFiber.stateNode;
const markers = instance.pendingMarkers;
if (markers !== null) {
markers.forEach(marker => {
if (marker.pendingBoundaries.has(instance)) {
marker.pendingBoundaries.delete(instance);
}
});
const transitions = instance.transitions;
if (transitions !== null) {
let name = null;
const parent = deletedFiber.return;
if (
parent !== null &&
parent.tag === SuspenseComponent &&
parent.memoizedProps.unstable_name
) {
name = parent.memoizedProps.unstable_name;
}

recursivelyAbortParentMarkerTransitions(
deletedFiber,
nearestMountedAncestor,
{
type: 'suspense',
name,
},
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ function getFilteredDeletion(deletion: TransitionDeletion, endTime: number) {
endTime,
};
}
case 'suspense': {
return {
type: deletion.type,
name: deletion.name,
endTime,
};
}
default: {
return null;
}
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 @@ -291,7 +291,7 @@ export type TransitionTracingCallbacks = {
startTime: number,
deletions: Array<{
type: string,
name?: string,
name?: string | null,
endTime: number,
}>,
) => void,
Expand All @@ -313,7 +313,7 @@ export type TransitionTracingCallbacks = {
startTime: number,
deletions: Array<{
type: string,
name?: string,
name?: string | null,
endTime: number,
}>,
) => void,
Expand Down
Loading

0 comments on commit 1fc184d

Please sign in to comment.