@@ -592,6 +592,33 @@ function onConnect<S, A extends Action<string>>(port: chrome.runtime.Port) {
592592 } ;
593593 port . onMessage . addListener ( listener ) ;
594594 port . onDisconnect . addListener ( disconnect ( 'panel' , id , listener ) ) ;
595+
596+ const { current } = store . getState ( ) . instances ;
597+ if ( current !== 'default' ) {
598+ const connectionId = Object . entries (
599+ store . getState ( ) . instances . connections ,
600+ ) . find ( ( [ , instanceIds ] ) => instanceIds . includes ( current ) ) ?. [ 0 ] ;
601+ const options = store . getState ( ) . instances . options [ current ] ;
602+ const state = store . getState ( ) . instances . states [ current ] ;
603+ const { actionsById, computedStates, committedState, ...rest } = state ;
604+ toMonitors ( {
605+ type : UPDATE_STATE ,
606+ request : {
607+ type : 'STATE' ,
608+ payload : rest as Omit <
609+ LiftedState < S , A , unknown > ,
610+ 'actionsById' | 'computedStates' | 'committedState'
611+ > ,
612+ source : '@devtools-page' ,
613+ instanceId :
614+ typeof current === 'number' ? current . toString ( ) : current ,
615+ actionsById : stringifyJSON ( actionsById , options . serialize ) ,
616+ computedStates : stringifyJSON ( computedStates , options . serialize ) ,
617+ committedState : typeof committedState !== 'undefined' ,
618+ } ,
619+ id : connectionId ?? current ,
620+ } ) ;
621+ }
595622 }
596623}
597624
0 commit comments