Skip to content

Confirm integration disconnects#1895

Open
rabanspiegel wants to merge 1 commit intomainfrom
raban/eng-993-clicking-linear-integration-button-deletes-saved-api-key
Open

Confirm integration disconnects#1895
rabanspiegel wants to merge 1 commit intomainfrom
raban/eng-993-clicking-linear-integration-button-deletes-saved-api-key

Conversation

@rabanspiegel
Copy link
Copy Markdown
Contributor

@rabanspiegel rabanspiegel commented May 6, 2026

Summary

  • add a confirmation modal before disconnecting enabled integrations
  • reuse the existing confirm action modal with Cmd+Enter confirmation support
  • keep CLI-managed GitHub disconnect disabled with its existing tooltip

Validation

  • manually verified Linear disconnect opens the modal and only clears the API key after confirmation
  • not run: automated tests/format per request
CleanShot 2026-05-05 at 22 16 48@2x

Note

Low Risk
Low risk UI behavior change that gates existing disconnect actions behind a confirmation modal; primary risk is minor UX regression if modal wiring blocks disconnect flows.

Overview
Adds a confirmation step before disconnecting any enabled integration in IntegrationsCard by routing all onDisconnect handlers through the existing confirmActionModal.

The modal copy is tailored per integration (e.g., calling out deletion of saved API keys/credentials), while preserving the existing CLI-managed GitHub disconnect disable/tooltip behavior.

Reviewed by Cursor Bugbot for commit 4f8cd30. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Greptile Summary

This PR adds a confirmation modal before disconnecting any enabled integration, reusing the existing confirmActionModal / ConfirmActionDialog system (which already includes Cmd+Enter shortcut support). A single confirmDisconnect helper is introduced and wired up to all six integrations (GitHub, Linear, Jira, GitLab, Plain, Forgejo), with the CLI-managed GitHub path correctly left unchanged.

  • A new confirmDisconnect function opens confirmActionModal with a tailored title, description (optionally naming the stored credential type), and a "Disconnect" confirm label, then invokes the actual disconnect inside onSuccess.
  • All six integrations are updated to go through this confirmation step; the CLI-managed GitHub tooltip path is unaffected since that card renders the disabled-tooltip branch instead of the disconnect button.

Confidence Score: 4/5

Safe to merge — the confirmation flow is correctly wired using an established modal pattern, and the only concern is that async disconnect errors are discarded without user feedback.

The implementation is straightforward and consistent with how confirmActionModal is used elsewhere in the codebase. The void onDisconnect() in the onSuccess callback discards any Promise rejection from the underlying mutateAsync call — if a disconnect fails at the network level, the modal has already closed and nothing is surfaced to the user. This was similarly silent before the PR, but the void keyword now makes the discard explicit.

Only IntegrationsCard.tsx changed; the onSuccess async-error path in confirmDisconnect is the one spot worth a second look.

Important Files Changed

Filename Overview
src/renderer/features/settings/components/IntegrationsCard.tsx Adds a confirmDisconnect helper and wires all six integrations through confirmActionModal before disconnecting; logic is correct but async disconnect errors are swallowed silently via void onDisconnect().

Sequence Diagram

sequenceDiagram
    actor User
    participant IC as IntegrationsCard
    participant CAD as ConfirmActionDialog
    participant MP as ModalProvider (wrapArgs)
    participant DP as disconnect* fn

    User->>IC: Click disconnect button
    IC->>MP: showConfirmDisconnect({ title, description, confirmLabel, onSuccess })
    MP->>CAD: open modal
    User->>CAD: Click Disconnect (or Cmd+Enter)
    CAD->>MP: onSuccess()
    MP->>MP: modalStore.closeModal('completed')
    MP->>IC: args.onSuccess()
    IC->>DP: void onDisconnect()
    Note over IC,DP: Promise returned, but not awaited
    DP-->>IC: resolve / reject (silently swallowed)
    User->>CAD: Click Cancel
    CAD->>MP: onClose()
    MP->>MP: modalStore.closeModal('dismissed')
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/renderer/features/settings/components/IntegrationsCard.tsx:89-91
Async disconnect errors are silently swallowed here. `void onDisconnect()` discards the returned `Promise`, so if `disconnectMutation.mutateAsync()` (inside each disconnect function) rejects — e.g. a network failure — the modal has already closed and the user receives no feedback. The integration card will remain in the connected state, but no error is surfaced. Consider awaiting the promise or propagating the error to a toast.

```suggestion
      onSuccess: async () => {
        try {
          await onDisconnect();
        } catch {
          // TODO: surface disconnect errors (e.g. via toast)
        }
      },
```

Reviews (1): Last reviewed commit: "Confirm integration disconnects" | Re-trigger Greptile

Comment on lines +89 to +91
onSuccess: () => {
void onDisconnect();
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Async disconnect errors are silently swallowed here. void onDisconnect() discards the returned Promise, so if disconnectMutation.mutateAsync() (inside each disconnect function) rejects — e.g. a network failure — the modal has already closed and the user receives no feedback. The integration card will remain in the connected state, but no error is surfaced. Consider awaiting the promise or propagating the error to a toast.

Suggested change
onSuccess: () => {
void onDisconnect();
},
onSuccess: async () => {
try {
await onDisconnect();
} catch {
// TODO: surface disconnect errors (e.g. via toast)
}
},
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/renderer/features/settings/components/IntegrationsCard.tsx
Line: 89-91

Comment:
Async disconnect errors are silently swallowed here. `void onDisconnect()` discards the returned `Promise`, so if `disconnectMutation.mutateAsync()` (inside each disconnect function) rejects — e.g. a network failure — the modal has already closed and the user receives no feedback. The integration card will remain in the connected state, but no error is surfaced. Consider awaiting the promise or propagating the error to a toast.

```suggestion
      onSuccess: async () => {
        try {
          await onDisconnect();
        } catch {
          // TODO: surface disconnect errors (e.g. via toast)
        }
      },
```

How can I resolve this? If you propose a fix, please make it concise.

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