feat: allow user to use existing integration to connect in PC#1946
feat: allow user to use existing integration to connect in PC#1946
Conversation
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx
Line: 521-531
Comment:
**"Connect a different GitHub org" should be disabled while linking**
While `linkExistingMutation` is pending this button is still enabled, so a user who clicks "Reuse" and then immediately clicks "Connect a different GitHub org" can kick off a new OAuth flow while the link request is in flight. Consider disabling or hiding it when `linkExistingMutation.isPending`.
```suggestion
<Button
size="1"
variant="ghost"
color="gray"
loading={isConnecting}
disabled={linkExistingMutation.isPending}
onClick={() => void handleConnectGitHub()}
>
Connect a different GitHub org
<ArrowSquareOut size={12} />
</Button>
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx
Line: 109
Comment:
**`alternativeSourceIntegrationId` is redundant**
`alternativeSourceIntegrationId` is just `alternativeSource?.id ?? null`. Since `alternativeSource` already exposes `id`, this extra variable violates OnceAndOnlyOnce — callers can use `alternativeSource?.id ?? null` directly or check `alternativeSource !== null` to gate the "Reuse" button.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat: allow user to use existing integra..." | Re-trigger Greptile |
| <Button | ||
| size="1" | ||
| variant="ghost" | ||
| color="gray" | ||
| loading={isConnecting} | ||
| onClick={() => void handleConnectGitHub()} | ||
| > | ||
| Connect a different GitHub org | ||
| <ArrowSquareOut size={12} /> | ||
| </Button> | ||
| </Flex> |
There was a problem hiding this comment.
"Connect a different GitHub org" should be disabled while linking
While linkExistingMutation is pending this button is still enabled, so a user who clicks "Reuse" and then immediately clicks "Connect a different GitHub org" can kick off a new OAuth flow while the link request is in flight. Consider disabling or hiding it when linkExistingMutation.isPending.
| <Button | |
| size="1" | |
| variant="ghost" | |
| color="gray" | |
| loading={isConnecting} | |
| onClick={() => void handleConnectGitHub()} | |
| > | |
| Connect a different GitHub org | |
| <ArrowSquareOut size={12} /> | |
| </Button> | |
| </Flex> | |
| <Button | |
| size="1" | |
| variant="ghost" | |
| color="gray" | |
| loading={isConnecting} | |
| disabled={linkExistingMutation.isPending} | |
| onClick={() => void handleConnectGitHub()} | |
| > | |
| Connect a different GitHub org | |
| <ArrowSquareOut size={12} /> | |
| </Button> |
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: 521-531
Comment:
**"Connect a different GitHub org" should be disabled while linking**
While `linkExistingMutation` is pending this button is still enabled, so a user who clicks "Reuse" and then immediately clicks "Connect a different GitHub org" can kick off a new OAuth flow while the link request is in flight. Consider disabling or hiding it when `linkExistingMutation.isPending`.
```suggestion
<Button
size="1"
variant="ghost"
color="gray"
loading={isConnecting}
disabled={linkExistingMutation.isPending}
onClick={() => void handleConnectGitHub()}
>
Connect a different GitHub org
<ArrowSquareOut size={12} />
</Button>
```
How can I resolve this? If you propose a fix, please make it concise.| githubAccountName: source.config?.account?.name ?? null, | ||
| }; | ||
| }, [alternativeConnectedProject]); | ||
| const alternativeSourceIntegrationId = alternativeSource?.id ?? null; |
There was a problem hiding this comment.
alternativeSourceIntegrationId is redundant
alternativeSourceIntegrationId is just alternativeSource?.id ?? null. Since alternativeSource already exposes id, this extra variable violates OnceAndOnlyOnce — callers can use alternativeSource?.id ?? null directly or check alternativeSource !== null to gate the "Reuse" button.
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: 109
Comment:
**`alternativeSourceIntegrationId` is redundant**
`alternativeSourceIntegrationId` is just `alternativeSource?.id ?? null`. Since `alternativeSource` already exposes `id`, this extra variable violates OnceAndOnlyOnce — callers can use `alternativeSource?.id ?? null` directly or check `alternativeSource !== null` to gate the "Reuse" button.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
8d5fc9a to
4ed00cc
Compare
jonathanlab
left a comment
There was a problem hiding this comment.
LGTM! The graphite comment does raise a valid point
48efd06 to
d7bf4ee
Compare
Aligns with the matching backend change in PostHog #57029, which switched from accepting an integration row id to accepting a sibling team id. The team id is already collected in availableInstallations, so this just renames the parameter and drops the now-unused sourceIntegrationId field from the dedupe map. Generated-By: PostHog Code Task-Id: f5372c83-7ea4-41dd-8f04-71191dff5782
Prevents kicking off a new OAuth flow while the link request is in flight. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d7bf4ee to
f8d5793
Compare

Problem
Changes