@@ -117,36 +117,26 @@ export function pushRootMarkerInstance(workInProgress: Fiber): void {
117117 // marker does, so we can push it onto the marker instance stack
118118 const transitions = getWorkInProgressTransitions ( ) ;
119119 const root = workInProgress . stateNode ;
120- let incompleteTransitions = root . incompleteTransitions ;
121- if ( transitions !== null ) {
122- // Create a mapping from transition to suspense boundaries
123- // We instantiate this lazily, only if transitions exist
124- if ( incompleteTransitions === null ) {
125- root . incompleteTransitions = incompleteTransitions = new Map ( ) ;
126- }
127120
121+ if ( transitions !== null ) {
128122 transitions . forEach ( transition => {
129- // We need to create a new map here because we only have access to the
130- // object instance in the commit phase
131- incompleteTransitions . set ( transition , new Map ( ) ) ;
123+ if ( ! root . incompleteTransitions . has ( transition ) ) {
124+ root . incompleteTransitions . set ( transition , {
125+ transitions : new Set ( [ transition ] ) ,
126+ pendingSuspenseBoundaries : null ,
127+ } ) ;
128+ }
132129 } ) ;
133130 }
134131
135- if ( incompleteTransitions === null ) {
136- push ( markerInstanceStack , null , workInProgress ) ;
137- } else {
138- const markerInstances = [ ] ;
139- // For ever transition on the suspense boundary, we push the transition
140- // along with its map of pending suspense boundaries onto the marker
141- // instance stack.
142- incompleteTransitions . forEach ( ( pendingSuspenseBoundaries , transition ) => {
143- markerInstances . push ( {
144- transitions : new Set ( [ transition ] ) ,
145- pendingSuspenseBoundaries,
146- } ) ;
147- } ) ;
148- push ( markerInstanceStack , markerInstances , workInProgress ) ;
149- }
132+ const markerInstances = [ ] ;
133+ // For ever transition on the suspense boundary, we push the transition
134+ // along with its map of pending suspense boundaries onto the marker
135+ // instance stack.
136+ root . incompleteTransitions . forEach ( markerInstance => {
137+ markerInstances . push ( markerInstance ) ;
138+ } ) ;
139+ push ( markerInstanceStack , markerInstances , workInProgress ) ;
150140 }
151141}
152142
0 commit comments