Skip to content

Fix Gemini API key input opening OAuth modal on focus#167

Merged
khaliqgant merged 1 commit intomainfrom
fix/gemini-api-key-input
Jan 12, 2026
Merged

Fix Gemini API key input opening OAuth modal on focus#167
khaliqgant merged 1 commit intomainfrom
fix/gemini-api-key-input

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Fixes bug where clicking/focusing the API key input field for Gemini opens the OAuth popup
  • Issue: User clicks "Or enter API key manually", then focuses the input, and OAuth modal appears

Root Cause

In WorkspaceSettingsPanel.tsx, the render logic checked conditions in this order:

  1. connectingProvider === provider.id → shows ProviderAuthFlow (OAuth)
  2. showApiKeyFallback[provider.id] → shows API key input

When the user focused the API key input, onFocus set connectingProvider to the provider ID. This made condition 1 true, causing ProviderAuthFlow to render. Since ProviderAuthFlow auto-starts OAuth on mount, the popup would open.

Fix

Changed the condition from:

connectingProvider === provider.id

to:

connectingProvider === provider.id && !showApiKeyFallback[provider.id]

Now, when the user is in API key fallback mode, the OAuth flow won't render even if connectingProvider is set.

Test plan

  • Open Workspace Settings > AI Providers
  • Click "Or enter API key manually" for Gemini
  • Click/focus the API key input field
  • Verify no popup opens, input field works normally
  • Type/paste an API key
  • Verify Connect button works

🤖 Generated with Claude Code

When the user clicked "Or enter API key manually" for a provider like
Gemini and then focused the API key input field, the OAuth popup would
open unexpectedly.

Root cause: The input's onFocus handler set `connectingProvider` to the
provider ID. The render condition `connectingProvider === provider.id`
was checked BEFORE `showApiKeyFallback[provider.id]`, so it would render
ProviderAuthFlow (which auto-starts OAuth on mount) instead of the API
key input.

Fix: Add `&& !showApiKeyFallback[provider.id]` to the condition, so that
when the user is in API key fallback mode, it doesn't render the OAuth
flow even if connectingProvider is set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@my-senior-dev-pr-review
Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/dashboard/react-components/ (7 edits) • ⚡ 25th PR this month

View your contributor analytics →


📊 1 file reviewed • 4 need attention

⚠️ Needs Attention:

  • src/dashboard/react-components/settings/WorkspaceSettingsPanel.tsx — The changes involve crucial UI state management affecting user interactions and may lead to logical issues in rendering.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@khaliqgant khaliqgant merged commit 193c972 into main Jan 12, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/gemini-api-key-input branch January 12, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant