Repository navigation
Conversation
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx:595-608
**Dialog closes immediately on click, bypassing loading state**
`AlertDialog.Action` calls `onOpenChange(false)` synchronously when clicked (the event bubbles up from the inner `Button`). At that moment, `disconnectMutation.isPending` is still `false` in the `onOpenChange` closure — React hasn't committed the state update from `mutate()` yet. So the `onOpenChange` guard passes, `setDisconnectConfirmOpen(false)` is called, and the dialog closes immediately rather than staying open to show the spinner.
`e.preventDefault()` doesn't help here — it only prevents the browser's native default action, not programmatic React handlers higher in the tree.
Since `onSuccess` already closes the dialog explicitly, the simplest fix is to move the confirm button out of `AlertDialog.Action`:
```tsx
<Flex gap="3" mt="4" justify="end">
<AlertDialog.Cancel asChild>
<Button variant="soft" color="gray" disabled={disconnectMutation.isPending}>
Cancel
</Button>
</AlertDialog.Cancel>
<Button
variant="solid"
color="red"
onClick={() => disconnectMutation.mutate()}
disabled={disconnectMutation.isPending}
>
{disconnectMutation.isPending ? <Spinner size="1" /> : null}
Disconnect
</Button>
</Flex>
```
This keeps the `onOpenChange` guard meaningful and allows the spinner to be visible during the request.
Reviews (1): Last reviewed commit: "feat(code): add inline GitHub disconnect..." | Re-trigger Greptile |
| <AlertDialog.Action> | ||
| <Button | ||
| variant="solid" | ||
| color="red" | ||
| onClick={(e) => { | ||
| e.preventDefault(); | ||
| disconnectMutation.mutate(); | ||
| }} | ||
| disabled={disconnectMutation.isPending} | ||
| > | ||
| {disconnectMutation.isPending ? <Spinner size="1" /> : null} | ||
| Disconnect | ||
| </Button> | ||
| </AlertDialog.Action> |
There was a problem hiding this comment.
Dialog closes immediately on click, bypassing loading state
AlertDialog.Action calls onOpenChange(false) synchronously when clicked (the event bubbles up from the inner Button). At that moment, disconnectMutation.isPending is still false in the onOpenChange closure — React hasn't committed the state update from mutate() yet. So the onOpenChange guard passes, setDisconnectConfirmOpen(false) is called, and the dialog closes immediately rather than staying open to show the spinner.
e.preventDefault() doesn't help here — it only prevents the browser's native default action, not programmatic React handlers higher in the tree.
Since onSuccess already closes the dialog explicitly, the simplest fix is to move the confirm button out of AlertDialog.Action:
<Flex gap="3" mt="4" justify="end">
<AlertDialog.Cancel asChild>
<Button variant="soft" color="gray" disabled={disconnectMutation.isPending}>
Cancel
</Button>
</AlertDialog.Cancel>
<Button
variant="solid"
color="red"
onClick={() => disconnectMutation.mutate()}
disabled={disconnectMutation.isPending}
>
{disconnectMutation.isPending ? <Spinner size="1" /> : null}
Disconnect
</Button>
</Flex>This keeps the onOpenChange guard meaningful and allows the spinner to be visible during the request.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx
Line: 595-608
Comment:
**Dialog closes immediately on click, bypassing loading state**
`AlertDialog.Action` calls `onOpenChange(false)` synchronously when clicked (the event bubbles up from the inner `Button`). At that moment, `disconnectMutation.isPending` is still `false` in the `onOpenChange` closure — React hasn't committed the state update from `mutate()` yet. So the `onOpenChange` guard passes, `setDisconnectConfirmOpen(false)` is called, and the dialog closes immediately rather than staying open to show the spinner.
`e.preventDefault()` doesn't help here — it only prevents the browser's native default action, not programmatic React handlers higher in the tree.
Since `onSuccess` already closes the dialog explicitly, the simplest fix is to move the confirm button out of `AlertDialog.Action`:
```tsx
<Flex gap="3" mt="4" justify="end">
<AlertDialog.Cancel asChild>
<Button variant="soft" color="gray" disabled={disconnectMutation.isPending}>
Cancel
</Button>
</AlertDialog.Cancel>
<Button
variant="solid"
color="red"
onClick={() => disconnectMutation.mutate()}
disabled={disconnectMutation.isPending}
>
{disconnectMutation.isPending ? <Spinner size="1" /> : null}
Disconnect
</Button>
</Flex>
```
This keeps the `onOpenChange` guard meaningful and allows the spinner to be visible during the request.
How can I resolve this? If you propose a fix, please make it concise.c7a6575 to
ed45726
Compare
666b43f to
2f25fac
Compare
2f25fac to
5a06832
Compare

Problem
Users who connect their personal GitHub account during onboarding have no way to disconnect it without leaving the app. This makes it difficult to switch accounts or revoke access without going directly to GitHub or PostHog settings.
Changes
AlertDialogthat explains the scope of the disconnection (personal authorization only; the GitHub App installation in the org is unaffected).disconnectGithubUserIntegrationAPI method that sends aDELETErequest to/api/users/@me/integrations/github/{installationId}/.invalidateGithubQuerieshelper so it can be reused across the connect and disconnect flows.