@@ -28,6 +28,7 @@ export function useMcpInstallationCache() {
2828 const installationId = route . params . id as string
2929 const storageKeyName = `mcp_installation_name_${ installationId } `
3030 const storageKeyIcon = `mcp_installation_icon_${ installationId } `
31+ const storageKeyRole = `mcp_installation_user_role_${ installationId } `
3132
3233 async function loadInstallation ( installationId : string ) : Promise < InstallationLoadResult | null > {
3334 try {
@@ -100,6 +101,9 @@ export function useMcpInstallationCache() {
100101 } )
101102 }
102103
104+ // Cache the user role for instant loading on tab switches
105+ eventBus . setState ( storageKeyRole , result . userRole )
106+
103107 setBreadcrumbs ( [
104108 { label : t ( 'mcpInstallations.title' ) , href : '/mcp-server' } ,
105109 { label : result . installation . installation_name }
@@ -113,6 +117,7 @@ export function useMcpInstallationCache() {
113117 // Clear cached data if installation not found
114118 eventBus . clearState ( storageKeyName )
115119 eventBus . clearState ( storageKeyIcon )
120+ eventBus . clearState ( storageKeyRole )
116121 }
117122 } catch ( err ) {
118123 error . value = err instanceof Error ? err . message : 'An unknown error occurred'
@@ -123,6 +128,7 @@ export function useMcpInstallationCache() {
123128 // Clear cached data on error
124129 eventBus . clearState ( storageKeyName )
125130 eventBus . clearState ( storageKeyIcon )
131+ eventBus . clearState ( storageKeyRole )
126132 } finally {
127133 isLoading . value = false
128134 }
@@ -137,13 +143,18 @@ export function useMcpInstallationCache() {
137143 // Load cached installation data immediately to prevent flicker
138144 const cachedName = eventBus . getState < string > ( storageKeyName )
139145 const cachedIcon = eventBus . getState < { icon_url : string ; name : string } > ( storageKeyIcon )
146+ const cachedRole = eventBus . getState < 'team_admin' | 'team_user' > ( storageKeyRole )
140147
141148 if ( cachedName && ! installation . value ) {
142149 installation . value = {
143150 installation_name : cachedName ,
144151 server : cachedIcon || undefined
145152 } as McpInstallation
146153 }
154+
155+ if ( cachedRole ) {
156+ userTeamRole . value = cachedRole
157+ }
147158 }
148159
149160 function setupWatchers ( onTeamChanged ?: ( ) => Promise < void > ) {
@@ -155,8 +166,10 @@ export function useMcpInstallationCache() {
155166 // Clear old installation's cached data
156167 const oldStorageKeyName = `mcp_installation_name_${ oldId } `
157168 const oldStorageKeyIcon = `mcp_installation_icon_${ oldId } `
169+ const oldStorageKeyRole = `mcp_installation_user_role_${ oldId } `
158170 eventBus . clearState ( oldStorageKeyName )
159171 eventBus . clearState ( oldStorageKeyIcon )
172+ eventBus . clearState ( oldStorageKeyRole )
160173
161174 // Reset installation to null to trigger loading state
162175 installation . value = null
0 commit comments