@@ -111,25 +111,35 @@ export const createGitHubPrContextUiController = ({
111111 workspacesToggle . disabled = false
112112 }
113113
114- aiChatToggle ?. removeAttribute ( 'hidden' )
114+ if ( aiChatToggle instanceof HTMLElement ) {
115+ aiChatToggle . hidden = false
116+ }
115117
116- githubPrToggle ?. removeAttribute ( 'hidden' )
118+ if ( githubPrToggle instanceof HTMLElement ) {
119+ githubPrToggle . hidden = false
120+ }
117121 if ( ! contextState . activePrContext ) {
118- workspacesToggle ?. removeAttribute ( 'hidden' )
122+ if ( workspacesToggle instanceof HTMLElement ) {
123+ workspacesToggle . hidden = false
124+ }
119125 }
120126
121127 if ( contextState . activePrContext ) {
122128 githubPrContextClose ?. removeAttribute ( 'hidden' )
123129 githubPrContextDisconnect ?. removeAttribute ( 'hidden' )
124- workspacesToggle ?. setAttribute ( 'hidden' , '' )
130+ if ( workspacesToggle instanceof HTMLElement ) {
131+ workspacesToggle . hidden = true
132+ }
125133 } else {
126134 githubPrContextClose ?. setAttribute ( 'hidden' , '' )
127135 githubPrContextDisconnect ?. setAttribute ( 'hidden' , '' )
128136 }
129137 return
130138 }
131139
132- aiChatToggle ?. setAttribute ( 'hidden' , '' )
140+ if ( aiChatToggle instanceof HTMLElement ) {
141+ aiChatToggle . hidden = true
142+ }
133143 aiChatToggle ?. setAttribute ( 'aria-expanded' , 'false' )
134144 if ( workspacesToggle instanceof HTMLButtonElement ) {
135145 workspacesToggle . disabled = true
@@ -139,9 +149,13 @@ export const createGitHubPrContextUiController = ({
139149 contextState . hasSyncedActivePrEditorContent = false
140150 syncEditorPrContextIndicators ( false )
141151 setGitHubPrToggleVisual ( 'open-pr' )
142- githubPrToggle ?. setAttribute ( 'hidden' , '' )
152+ if ( githubPrToggle instanceof HTMLElement ) {
153+ githubPrToggle . hidden = true
154+ }
143155 githubPrToggle ?. setAttribute ( 'aria-expanded' , 'false' )
144- workspacesToggle ?. setAttribute ( 'hidden' , '' )
156+ if ( workspacesToggle instanceof HTMLElement ) {
157+ workspacesToggle . hidden = true
158+ }
145159 workspacesToggle ?. setAttribute ( 'aria-expanded' , 'false' )
146160 githubPrContextClose ?. setAttribute ( 'hidden' , '' )
147161 githubPrContextDisconnect ?. setAttribute ( 'hidden' , '' )
0 commit comments