@@ -87,9 +87,10 @@ const filterGuides = (
8787
8888type Props = {
8989 readyToTarget : boolean ;
90+ listenForUpdates : boolean ;
9091} ;
9192
92- export const V2 = ( { readyToTarget } : Props ) => {
93+ export const V2 = ( { readyToTarget, listenForUpdates } : Props ) => {
9394 const { client } = useGuideContext ( ) ;
9495
9596 const [ displayOption , setDisplayOption ] =
@@ -111,6 +112,7 @@ export const V2 = ({ readyToTarget }: Props) => {
111112 React . useEffect ( ( ) => {
112113 const { isVisible = false , focusedGuideKeys = { } } = runConfig || { } ;
113114 const isDebugging = client . store . state . debug ?. debugging ;
115+
114116 if ( isVisible && ! isDebugging && readyToTarget ) {
115117 client . setDebug ( { focusedGuideKeys } ) ;
116118
@@ -120,10 +122,16 @@ export const V2 = ({ readyToTarget }: Props) => {
120122 }
121123 }
122124
125+ if ( ! isVisible && isDebugging ) {
126+ client . unsetDebug ( { listenForUpdates } ) ;
127+ }
128+
123129 return ( ) => {
124- client . unsetDebug ( ) ;
130+ if ( client . store . state . debug ?. debugging ) {
131+ client . unsetDebug ( { listenForUpdates } ) ;
132+ }
125133 } ;
126- } , [ readyToTarget , runConfig , client , setDisplayOption ] ) ;
134+ } , [ readyToTarget , listenForUpdates , runConfig , client , setDisplayOption ] ) ;
127135
128136 // Toggle collapsed state with Ctrl + .
129137 React . useEffect ( ( ) => {
@@ -351,7 +359,6 @@ export const V2 = ({ readyToTarget }: Props) => {
351359 leadingIcon = { { icon : LogOut , alt : "Exit" } }
352360 onClick = { ( ) => {
353361 setRunConfig ( ( curr ) => ( { ...curr , isVisible : false } ) ) ;
354- client . unsetDebug ( ) ;
355362 } }
356363 >
357364 Exit
0 commit comments