@@ -138,6 +138,7 @@ import {
138138 enqueuePendingPassiveProfilerEffect ,
139139 restorePendingUpdaters ,
140140 addTransitionStartCallbackToPendingTransition ,
141+ addTransitionProgressCallbackToPendingTransition ,
141142 addTransitionCompleteCallbackToPendingTransition ,
142143 addMarkerCompleteCallbackToPendingTransition ,
143144 setIsRunningInsertionEffect ,
@@ -1110,20 +1111,32 @@ function commitTransitionProgress(offscreenFiber: Fiber) {
11101111 // The suspense boundaries was just hidden. Add the boundary
11111112 // to the pending boundary set if it's there
11121113 if ( pendingMarkers !== null ) {
1113- pendingMarkers . forEach ( pendingBoundaries => {
1114- pendingBoundaries . set ( offscreenInstance , {
1115- name,
1116- } ) ;
1114+ pendingMarkers . forEach ( markerInstance => {
1115+ const pendingBoundaries = markerInstance . pendingSuspenseBoundaries ;
1116+ if (
1117+ pendingBoundaries !== null &&
1118+ ! pendingBoundaries . has ( offscreenInstance )
1119+ ) {
1120+ pendingBoundaries . set ( offscreenInstance , {
1121+ name,
1122+ } ) ;
1123+ markerInstance . hasUpdate = true ;
1124+ }
11171125 } ) ;
11181126 }
11191127 } else if ( wasHidden && ! isHidden ) {
11201128 // The suspense boundary went from hidden to visible. Remove
11211129 // the boundary from the pending suspense boundaries set
11221130 // if it's there
11231131 if ( pendingMarkers !== null ) {
1124- pendingMarkers . forEach ( pendingBoundaries => {
1125- if ( pendingBoundaries . has ( offscreenInstance ) ) {
1132+ pendingMarkers . forEach ( markerInstance => {
1133+ const pendingBoundaries = markerInstance . pendingSuspenseBoundaries ;
1134+ if (
1135+ pendingBoundaries !== null &&
1136+ pendingBoundaries . has ( offscreenInstance )
1137+ ) {
11261138 pendingBoundaries . delete ( offscreenInstance ) ;
1139+ markerInstance . hasUpdate = true ;
11271140 }
11281141 } ) ;
11291142 }
@@ -2822,17 +2835,20 @@ function commitPassiveMountOnFiber(
28222835 clearTransitionsForLanes ( finishedRoot , committedLanes ) ;
28232836 }
28242837
2825- incompleteTransitions . forEach (
2826- ( { pendingSuspenseBoundaries} , transition ) => {
2827- if (
2828- pendingSuspenseBoundaries === null ||
2829- pendingSuspenseBoundaries . size === 0
2830- ) {
2831- addTransitionCompleteCallbackToPendingTransition ( transition ) ;
2832- incompleteTransitions . delete ( transition ) ;
2833- }
2834- } ,
2835- ) ;
2838+ incompleteTransitions . forEach ( ( markerInstance , transition ) => {
2839+ const pendingBoundaries = markerInstance . pendingSuspenseBoundaries ;
2840+ if ( markerInstance . hasUpdate ) {
2841+ addTransitionProgressCallbackToPendingTransition ( {
2842+ transition,
2843+ pending : pendingBoundaries || [ ] ,
2844+ } ) ;
2845+ markerInstance . hasUpdate = false ;
2846+ }
2847+ if ( pendingBoundaries === null || pendingBoundaries . size === 0 ) {
2848+ addTransitionCompleteCallbackToPendingTransition ( transition ) ;
2849+ incompleteTransitions . delete ( transition ) ;
2850+ }
2851+ } ) ;
28362852
28372853 clearTransitionsForLanes ( finishedRoot , committedLanes ) ;
28382854 }
@@ -2909,9 +2925,7 @@ function commitPassiveMountOnFiber(
29092925 instance . pendingMarkers = new Set ( ) ;
29102926 }
29112927
2912- instance . pendingMarkers . add (
2913- markerInstance . pendingSuspenseBoundaries ,
2914- ) ;
2928+ instance . pendingMarkers . add ( markerInstance ) ;
29152929 }
29162930 } ) ;
29172931 }
0 commit comments