@@ -399,24 +399,28 @@ export class SessionDataController implements ReactiveController, SessionCatalog
399399 }
400400 }
401401
402+ private resetChildSessionState ( ) : void {
403+ this . childSessionGeneration += 1 ;
404+ this . childSessionRowsByParent = { } ;
405+ this . loadedChildSessionKeys = new Set ( ) ;
406+ this . failedChildSessionKeys = new Set ( ) ;
407+ this . loadingChildSessionKeys = new Set ( ) ;
408+ this . activeSessionLineageRoot = null ;
409+ this . activeSessionLineageRouteKey = null ;
410+ this . activeSessionLineageLoaded = false ;
411+ this . activeSessionLineageRequestToken = null ;
412+ if ( this . activeSessionLineageRetryTimer ) {
413+ globalThis . clearTimeout ( this . activeSessionLineageRetryTimer ) ;
414+ this . activeSessionLineageRetryTimer = null ;
415+ }
416+ }
417+
402418 private readonly updateSessions = ( sessions : SessionCapability ) => {
403419 if ( this . childSessionCanonicalListRevision !== sessions . canonicalListRevision ) {
404420 this . childSessionCanonicalListRevision = sessions . canonicalListRevision ;
405421 // The canonical root list advances after session events, but excludes hidden children.
406422 // Drop child snapshots so expanded parents refetch live terminal state.
407- this . childSessionGeneration += 1 ;
408- this . childSessionRowsByParent = { } ;
409- this . loadedChildSessionKeys = new Set ( ) ;
410- this . failedChildSessionKeys = new Set ( ) ;
411- this . loadingChildSessionKeys = new Set ( ) ;
412- this . activeSessionLineageRoot = null ;
413- this . activeSessionLineageRouteKey = null ;
414- this . activeSessionLineageLoaded = false ;
415- this . activeSessionLineageRequestToken = null ;
416- if ( this . activeSessionLineageRetryTimer ) {
417- globalThis . clearTimeout ( this . activeSessionLineageRetryTimer ) ;
418- this . activeSessionLineageRetryTimer = null ;
419- }
423+ this . resetChildSessionState ( ) ;
420424 this . notify ( ) ;
421425 }
422426 const snapshot = sessions . state ;
@@ -512,24 +516,12 @@ export class SessionDataController implements ReactiveController, SessionCatalog
512516 }
513517
514518 private clearSessionCache ( ) : void {
515- this . childSessionGeneration += 1 ;
516519 this . childSessionCanonicalListRevision = null ;
517520 this . reconnectListRevision = null ;
518521 this . sessionsResult = null ;
519522 this . sessionsAgentId = null ;
520523 this . sessionRowsByAgent = { } ;
521- this . childSessionRowsByParent = { } ;
522- this . loadedChildSessionKeys = new Set ( ) ;
523- this . failedChildSessionKeys = new Set ( ) ;
524- this . loadingChildSessionKeys = new Set ( ) ;
525- this . activeSessionLineageRoot = null ;
526- this . activeSessionLineageRouteKey = null ;
527- this . activeSessionLineageLoaded = false ;
528- this . activeSessionLineageRequestToken = null ;
529- if ( this . activeSessionLineageRetryTimer ) {
530- globalThis . clearTimeout ( this . activeSessionLineageRetryTimer ) ;
531- this . activeSessionLineageRetryTimer = null ;
532- }
524+ this . resetChildSessionState ( ) ;
533525 this . sessionCreatedOrder . clear ( ) ;
534526 this . visibleSessionLimits . clear ( ) ;
535527 this . notify ( ) ;
@@ -680,10 +672,9 @@ export class SessionDataController implements ReactiveController, SessionCatalog
680672 this . sidebarSessionPaginationState . loadedScope = undefined ;
681673 this . sessionsLoading = false ;
682674 this . visibleSessionLimits . clear ( ) ;
683- this . childSessionRowsByParent = { } ;
684- this . loadedChildSessionKeys = new Set ( ) ;
685- this . failedChildSessionKeys = new Set ( ) ;
686- this . loadingChildSessionKeys = new Set ( ) ;
675+ // A filter transition owns a new child/lineage generation; otherwise a
676+ // pending request from the retired view can repopulate its cleared rows.
677+ this . resetChildSessionState ( ) ;
687678 this . sessionRowsByAgent = { } ;
688679 if ( statusFilter === "active" && this . context ) {
689680 this . sessionsResult = this . context . sessions . state . result ;
0 commit comments