@@ -16,7 +16,7 @@ import {
1616 DisplayOption ,
1717 GuidesListDisplaySelect ,
1818} from "./GuidesListDisplaySelect" ;
19- import { detectToolbarParam } from "./helpers" ;
19+ import { getRunConfig } from "./helpers" ;
2020import { useDraggable } from "./useDraggable" ;
2121import {
2222 InspectionResult ,
@@ -55,20 +55,19 @@ export const V2 = () => {
5555 const [ guidesListDisplayOption , setGuidesListDisplayOption ] =
5656 React . useState < DisplayOption > ( "only-displayable" ) ;
5757
58- const [ isVisible , setIsVisible ] = React . useState ( detectToolbarParam ( ) ) ;
58+ const [ runConfig , setRunConfig ] = React . useState ( ( ) => getRunConfig ( ) ) ;
5959 const [ isCollapsed , setIsCollapsed ] = React . useState ( true ) ;
6060
6161 React . useEffect ( ( ) => {
62- if ( ! isVisible ) {
63- return ;
62+ const isDebugging = client . store . state . debug ?. debugging ;
63+ if ( runConfig ?. isVisible && ! isDebugging ) {
64+ client . setDebug ( ) ;
6465 }
6566
66- client . setDebug ( ) ;
67-
6867 return ( ) => {
6968 client . unsetDebug ( ) ;
7069 } ;
71- } , [ isVisible , client ] ) ;
70+ } , [ runConfig , client ] ) ;
7271
7372 const containerRef = React . useRef < HTMLDivElement > ( null ) ;
7473 const { position, isDragging, handlePointerDown } = useDraggable ( {
@@ -79,7 +78,7 @@ export const V2 = () => {
7978 } ) ;
8079
8180 const result = useInspectGuideClientStore ( ) ;
82- if ( ! result ) {
81+ if ( ! result || ! runConfig ?. isVisible ) {
8382 return null ;
8483 }
8584
@@ -122,7 +121,10 @@ export const V2 = () => {
122121
123122 < Stack gap = "2" >
124123 < Button
125- onClick = { ( ) => setIsVisible ( false ) }
124+ onClick = { ( ) => {
125+ setRunConfig ( ( curr ) => ( { ...curr , isVisible : false } ) ) ;
126+ client . unsetDebug ( ) ;
127+ } }
126128 size = "1"
127129 variant = "soft"
128130 trailingIcon = { { icon : Undo2 , "aria-hidden" : true } }
0 commit comments