@@ -30,6 +30,7 @@ export type SuspenseTreeState = {
3030 hoveredTimelineIndex : number | - 1 ,
3131 uniqueSuspendersOnly : boolean ,
3232 playing : boolean ,
33+ autoSelect : boolean ,
3334} ;
3435
3536type ACTION_SUSPENSE_TREE_MUTATION = {
@@ -123,6 +124,7 @@ function getInitialState(store: Store): SuspenseTreeState {
123124 hoveredTimelineIndex : - 1 ,
124125 uniqueSuspendersOnly,
125126 playing : false ,
127+ autoSelect : true ,
126128 } ;
127129
128130 return initialState ;
@@ -181,7 +183,10 @@ function SuspenseTreeContextController({children}: Props): React.Node {
181183 selectedTimelineID === null || nextTimeline . length === 0
182184 ? - 1
183185 : nextTimeline . indexOf ( selectedTimelineID ) ;
184- if ( nextTimeline . length > 0 && nextTimelineIndex === - 1 ) {
186+ if (
187+ nextTimeline . length > 0 &&
188+ ( nextTimelineIndex === - 1 || state . autoSelect )
189+ ) {
185190 nextTimelineIndex = nextTimeline . length - 1 ;
186191 selectedSuspenseID = nextTimeline [ nextTimelineIndex ] ;
187192 }
@@ -212,6 +217,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
212217 ...state ,
213218 selectedSuspenseID,
214219 playing : false , // pause
220+ autoSelect : false ,
215221 } ;
216222 }
217223 case 'SET_SUSPENSE_LINEAGE' : {
@@ -223,6 +229,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
223229 lineage,
224230 selectedSuspenseID : suspenseID ,
225231 playing : false , // pause
232+ autoSelect : false ,
226233 } ;
227234 }
228235 case 'SET_SUSPENSE_TIMELINE' : {
@@ -277,6 +284,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
277284 selectedSuspenseID : nextSelectedSuspenseID ,
278285 timelineIndex : nextTimelineIndex ,
279286 playing : false , // pause
287+ autoSelect : false ,
280288 } ;
281289 }
282290 case 'SUSPENSE_SKIP_TIMELINE_INDEX' : {
@@ -299,6 +307,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
299307 selectedSuspenseID : nextSelectedSuspenseID ,
300308 timelineIndex : nextTimelineIndex ,
301309 playing : false , // pause
310+ autoSelect : false ,
302311 } ;
303312 }
304313 case 'SUSPENSE_PLAY_PAUSE' : {
@@ -325,6 +334,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
325334 selectedSuspenseID : nextSelectedSuspenseID ,
326335 timelineIndex : nextTimelineIndex ,
327336 playing : mode === 'toggle' ? ! state . playing : mode === 'play' ,
337+ autoSelect : false ,
328338 } ;
329339 }
330340 case 'SUSPENSE_PLAY_TICK' : {
@@ -381,6 +391,7 @@ function SuspenseTreeContextController({children}: Props): React.Node {
381391 selectedSuspenseID : nextSelectedSuspenseID ,
382392 timelineIndex : nextTimelineIndex ,
383393 playing : false , // pause
394+ autoSelect : false ,
384395 } ;
385396 }
386397 case 'HOVER_TIMELINE_FOR_ID' : {
0 commit comments