This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Repository navigation
feat(code): list all GitHub installations and allow adding another org #2001
Merged
k11kirky
merged 1 commit into
main
from
05-04-feat_code_list_all_github_installations_and_allow_adding_another_org
May 4, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,6 +148,7 @@ function useAllUserGithubRepositories( | |
| })), | ||
| combine: (results) => { | ||
| const map: Record<string, UserRepositoryIntegrationRef> = {}; | ||
| const reposByInstallationId: Record<string, string[]> = {}; | ||
| const failedInstallationIds: string[] = []; | ||
| let pending = false; | ||
| results.forEach((result, index) => { | ||
|
|
@@ -158,7 +159,9 @@ function useAllUserGithubRepositories( | |
| if (installationId) failedInstallationIds.push(installationId); | ||
| } | ||
| if (!result.data) return; | ||
| for (const repo of result.data.repos ?? []) { | ||
| const installationRepos = result.data.repos ?? []; | ||
| reposByInstallationId[result.data.installationId] = installationRepos; | ||
|
Comment on lines
+162
to
+163
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a result is in error or still pending, Prompt To Fix With AIThis 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. |
||
| for (const repo of installationRepos) { | ||
| if (!(repo in map)) { | ||
| map[repo] = { | ||
| userIntegrationId: result.data.userIntegrationId, | ||
|
|
@@ -169,6 +172,7 @@ function useAllUserGithubRepositories( | |
| }); | ||
| return { | ||
| repositoryMap: map, | ||
| reposByInstallationId, | ||
| isPending: pending, | ||
| failedInstallationIds, | ||
| }; | ||
|
|
@@ -501,6 +505,7 @@ export function useUserRepositoryIntegration() { | |
|
|
||
| const { | ||
| repositoryMap, | ||
| reposByInstallationId, | ||
| isPending: reposPending, | ||
| failedInstallationIds, | ||
| } = useAllUserGithubRepositories(githubIntegrations); | ||
|
|
@@ -569,6 +574,7 @@ export function useUserRepositoryIntegration() { | |
| refreshRepositories, | ||
| hasGithubIntegration: githubIntegrations.length > 0, | ||
| failedInstallationIds, | ||
| reposByInstallationId, | ||
| }; | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isConnectingloading state across all Reconnect buttonsisConnectingis global to the component. When a user clicks "Reconnect" on one stale installation andhandleConnectGitHub()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