diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index 9ea33893249..316521d9983 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -419,7 +419,7 @@ export const AppContainer = (props: AppContainerProps) => { handleAuthSelect, openAuthDialog, cancelAuthentication, - } = useAuthCommand(settings, config, historyManager.addItem); + } = useAuthCommand(settings, config, historyManager.addItem, refreshStatic); useInitializationAuthError(initializationResult.authError, onAuthError); diff --git a/packages/cli/src/ui/auth/useAuth.ts b/packages/cli/src/ui/auth/useAuth.ts index 8e5b28499ab..82211362cef 100644 --- a/packages/cli/src/ui/auth/useAuth.ts +++ b/packages/cli/src/ui/auth/useAuth.ts @@ -30,6 +30,7 @@ export const useAuthCommand = ( settings: LoadedSettings, config: Config, addItem: (item: Omit, timestamp: number) => void, + onAuthChange?: () => void, ) => { const unAuthenticated = config.getAuthType() === undefined; @@ -136,11 +137,10 @@ export const useAuthCommand = ( setIsAuthDialogOpen(false); setIsAuthenticating(false); - // Log authentication success - const authEvent = new AuthEvent(authType, 'manual', 'success'); - logAuth(config, authEvent); + // Trigger UI refresh to update header information + onAuthChange?.(); - // Show success message + // Add success message to history addItem( { type: MessageType.INFO, @@ -150,8 +150,12 @@ export const useAuthCommand = ( }, Date.now(), ); + + // Log authentication success + const authEvent = new AuthEvent(authType, 'manual', 'success'); + logAuth(config, authEvent); }, - [settings, handleAuthFailure, config, addItem], + [settings, handleAuthFailure, config, addItem, onAuthChange], ); const performAuth = useCallback(