feat(task-input): cache cloud repositories so picker renders instantly#2206
Draft
timgl wants to merge 1 commit into
Draft
feat(task-input): cache cloud repositories so picker renders instantly#2206timgl wants to merge 1 commit into
timgl wants to merge 1 commit into
Conversation
The cloud repo picker waited on a full integrations + per-installation repo fetch every time TaskInput mounted, even though the last-used repo was already known. Persist the repository map in settingsStore and use it as a stand-in while live data loads, so clicking "new task" shows the previously selected repo immediately and only kicks the network request in the background. Generated-By: PostHog Code Task-Id: 0b2985a5-f92f-40ad-b3b8-2dc44366566a
tatoalo
reviewed
May 19, 2026
| return; | ||
| } | ||
| if (reposPending) return; | ||
| if (Object.keys(repositoryMap).length === 0) return; |
Contributor
There was a problem hiding this comment.
here we can also add
if (reposPending) [..]
if (failedInstallationIds.length > 0) return;
if (Object.kyes(..)) [..]so we guard against persisting a partial map
tatoalo
approved these changes
May 19, 2026
Contributor
tatoalo
left a comment
There was a problem hiding this comment.
approved, just one nit regarding an additional guard to the setCachedCloudRepositoryMap path
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Clicking New task next to a repo in the sidebar would show a "Loading repos..." spinner in the GitHub repo picker, even though the answer was almost always the same repo the user picked last time. The picker waited on a full integrations + per-installation repo fetch from PostHog every mount, and only then could it validate the selection against the live list.
This change persists the user repository map in
settingsStoreand uses it as a stand-in while the live data loads, so the picker renders the last-used repo immediately. The network request still fires in the background and replaces the cache when it returns; the existing cleanup effect will still clear the selection if the repo turns out to be gone.Changes
settingsStore: new persisted fieldcachedCloudRepositoryMap(repo name →{ userIntegrationId, installationId }) + setter.useUserRepositoryIntegration:repositoryMapwhile live queries are pending andrepositoryMapis still empty.hasGithubIntegrationas true while integrations are loading if cache is non-empty, so the picker doesn't briefly collapse to local mode on cold start.No changes to
TaskInputare required — the existingselectedCloudRepositoryvalidation and the cleanup effect both already work against whatever the hook returns.Test plan
Created with PostHog Code