Skip to content

fix(email): fix Confirm/Update Integration broken in Gmail edit mode#564

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/email-wizard-edit-mode-confirm
Feb 27, 2026
Merged

fix(email): fix Confirm/Update Integration broken in Gmail edit mode#564
zbigniewsobiecki merged 1 commit intodevfrom
fix/email-wizard-edit-mode-confirm

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Confirm button did nothing — clicking it dispatched SET_VERIFICATION with email: state.gmailEmail, but gmailEmail was always null in edit mode, so verificationEmail stayed null
  • Update Integration button was always disabledstep3Complete = !!state.verificationEmail evaluated to false because verificationEmail was never populated

Root cause: INIT_EDIT set oauthComplete = true for existing Gmail integrations but never populated gmailEmail or verificationEmail. The email address was available all along — stored in the credential name as "Gmail: user@example.com" — but never looked up.

Fix: wait for orgCredentials to load, look up the gmail_email credential by ID from initialCredentials, strip the "Gmail: " prefix from its name, and pre-populate both gmailEmail and verificationEmail. Uses a useRef guard so INIT_EDIT only fires once even though orgCredentials is now a dependency.

After the fix, opening the email wizard on an existing Gmail integration immediately shows the email confirmed and "Update Integration" enabled — no re-verification needed.

Test plan

  • Open email integration settings for a project with an existing Gmail integration → verify step shows email, "Update Integration" button is active immediately
  • Click "Update Integration" → integration saves successfully
  • New Gmail setup (no existing integration) still works end-to-end
  • IMAP edit mode unaffected
  • npm run build:web — clean
  • npm run lint / npm run typecheck — clean

🤖 Generated with Claude Code

…isting Gmail integration

When opening the email wizard in edit mode for an existing Gmail
integration, INIT_EDIT set oauthComplete=true but left gmailEmail and
verificationEmail as null. This caused two problems:

1. Clicking "Confirm" dispatched SET_VERIFICATION with email: null
   (state.gmailEmail), so verificationEmail stayed null and the
   "Update Integration" button remained disabled.

2. The verify step showed "Gmail connection verified for " (empty name).

Fix: in the INIT_EDIT useEffect, wait for orgCredentials to load then
look up the gmail_email credential (stored as "Gmail: user@example.com")
and pre-populate both gmailEmail and verificationEmail. This auto-confirms
the verify step for existing integrations so "Update Integration" is
immediately enabled, consistent with how IMAP edit mode works.

Uses a useRef guard to ensure INIT_EDIT only fires once even though
orgCredentials is now a dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit b6f7e3b into dev Feb 27, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/email-wizard-edit-mode-confirm branch February 27, 2026 09:43
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