Repository navigation
feat(code): list all GitHub installations and allow adding another org - #2001
Conversation
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx:421-426
**Global loading state used per-installation card**
`isLoadingRepos` is a single boolean that is `true` as long as *any* installation's repo query is still pending. When a user has two orgs and one finishes loading before the other, the already-loaded card still displays "Loading…" instead of its actual repo count, because `isLoadingRepos` remains `true` until all queries settle.
A per-installation check would be more accurate — e.g. checking whether `reposByInstallationId[installationId]` is `undefined` (query hasn't resolved yet) vs. an array (already populated).
### Issue 2 of 3
apps/code/src/renderer/features/onboarding/components/GitIntegrationStep.tsx:440-450
**Shared `isConnecting` loading state across all Reconnect buttons**
`isConnecting` is global to the component. When a user clicks "Reconnect" on one stale installation and `handleConnectGitHub()` starts, all other "Reconnect" buttons will also enter a loading state simultaneously. If a user has two stale integrations, clicking Reconnect on one will visually indicate both are in-progress.
### Issue 3 of 3
apps/code/src/renderer/hooks/useIntegrations.ts:162-163
**`reposByInstallationId` not populated for error/loading states**
When a result is in error or still pending, `result.data` is falsy and the function returns early, leaving `reposByInstallationId[installationId]` undefined. In the component this correctly falls back to `[]` for stale installs (which show "Reconnect needed" instead), so the current behaviour is fine. However, it also means you can't distinguish "no repos returned by the API" (empty array) from "query hasn't completed yet" (undefined) at the component level — a distinction that would fix the per-installation loading concern above.
Reviews (1): Last reviewed commit: "feat(code): list all GitHub installation..." | Re-trigger Greptile |
| )} | ||
| <Button | ||
| size="1" | ||
| variant="soft" | ||
| color="gray" | ||
| onClick={() => { | ||
| const account = integration.account; | ||
| const url = | ||
| account?.type === "Organization" && | ||
| account.name | ||
| ? `https://github.com/organizations/${account.name}/settings/installations/${installationId}` |
There was a problem hiding this comment.
Shared
isConnecting loading state across all Reconnect buttons
isConnecting is global to the component. When a user clicks "Reconnect" on one stale installation and handleConnectGitHub() starts, all other "Reconnect" buttons will also enter a loading state simultaneously. If a user has two stale integrations, clicking Reconnect on one will visually indicate both are in-progress.
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: 440-450
Comment:
**Shared `isConnecting` loading state across all Reconnect buttons**
`isConnecting` is global to the component. When a user clicks "Reconnect" on one stale installation and `handleConnectGitHub()` starts, all other "Reconnect" buttons will also enter a loading state simultaneously. If a user has two stale integrations, clicking Reconnect on one will visually indicate both are in-progress.
How can I resolve this? If you propose a fix, please make it concise.| const installationRepos = result.data.repos ?? []; | ||
| reposByInstallationId[result.data.installationId] = installationRepos; |
There was a problem hiding this comment.
reposByInstallationId not populated for error/loading states
When a result is in error or still pending, result.data is falsy and the function returns early, leaving reposByInstallationId[installationId] undefined. In the component this correctly falls back to [] for stale installs (which show "Reconnect needed" instead), so the current behaviour is fine. However, it also means you can't distinguish "no repos returned by the API" (empty array) from "query hasn't completed yet" (undefined) at the component level — a distinction that would fix the per-installation loading concern above.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/hooks/useIntegrations.ts
Line: 162-163
Comment:
**`reposByInstallationId` not populated for error/loading states**
When a result is in error or still pending, `result.data` is falsy and the function returns early, leaving `reposByInstallationId[installationId]` undefined. In the component this correctly falls back to `[]` for stale installs (which show "Reconnect needed" instead), so the current behaviour is fine. However, it also means you can't distinguish "no repos returned by the API" (empty array) from "query hasn't completed yet" (undefined) at the component level — a distinction that would fix the per-installation loading concern above.
How can I resolve this? If you propose a fix, please make it concise.172b3fe to
c0863fa
Compare
039bbe6 to
72b415c
Compare
72b415c to
bf99ac0
Compare

Problem
Users with GitHub integrations connected to multiple organizations had no way to manage them individually — the UI only showed a single integration, and disconnect/reconnect actions were scoped to whichever integration happened to be first in the list.
Changes
Connected (N)when more than one integration is active, and "Reconnect needed" is shown when any integration is staleuseUserRepositoryIntegrationnow exposesreposByInstallationIdso each card can display the correct repo count for its installation