@@ -235,21 +235,24 @@ export const LogsRenderer = ({
235
235
*/
236
236
const getIsStageOpen = (
237
237
status : StageStatusType ,
238
- lastUserActionState : boolean ,
238
+ lastUserActionState : boolean | undefined ,
239
239
isSearchKeyPresent : boolean ,
240
240
isFromSearchAction : boolean ,
241
241
) : boolean => {
242
242
const isInitialState = stageList . length === 0
243
+ const lastActionState = lastUserActionState ?? true
243
244
245
+ // In case of search action, would open the stage if search key is present
246
+ // If search key is not present would return the last action state, if no action taken would return true(that is stage is new or being loaded)
244
247
if ( isFromSearchAction ) {
245
- return isSearchKeyPresent || lastUserActionState
248
+ return isSearchKeyPresent || lastActionState
246
249
}
247
250
248
251
if ( isInitialState ) {
249
252
return status !== StageStatusType . SUCCESS || isSearchKeyPresent
250
253
}
251
254
252
- return lastUserActionState ?? true
255
+ return lastActionState
253
256
}
254
257
255
258
/**
@@ -298,7 +301,12 @@ export const LogsRenderer = ({
298
301
startTime : startTime || '' ,
299
302
endTime : endTime || '' ,
300
303
// Would be defining the state when we receive the end status, otherwise it is loading and would be open
301
- isOpen : true ,
304
+ isOpen : getIsStageOpen (
305
+ StageStatusType . PROGRESSING ,
306
+ previousExistingStage . isOpen ,
307
+ ! ! searchKeyStatusMap [ stage ] ?. [ startTime ] ,
308
+ ! ! targetSearchKey ,
309
+ ) ,
302
310
status : StageStatusType . PROGRESSING ,
303
311
logs : [ ] ,
304
312
} )
0 commit comments