fix(mobile): paginate github_repos to show all repositories#2118
Open
posthog[bot] wants to merge 1 commit intomainfrom
Open
fix(mobile): paginate github_repos to show all repositories#2118posthog[bot] wants to merge 1 commit intomainfrom
posthog[bot] wants to merge 1 commit intomainfrom
Conversation
The mobile task creation flow called the team-level github_repos endpoint without pagination, so the repository picker capped at the backend's default page size of 100. PostHog orgs with more than 100 repositories in their GitHub App installation (e.g. PostHog itself) had repos like billing and charts truncated from the dropdown depending on cache order. Mirror the desktop client's pagination loop: request 500 at a time and follow has_more until the cache is exhausted. Generated-By: PostHog Code Task-Id: d6c191a5-70f9-4b82-b797-ef739b2b1f16
Contributor
|
Reviews (1): Last reviewed commit: "fix(mobile): paginate github_repos to sh..." | Re-trigger Greptile |
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.
Problem
When kicking off a task in the PostHog Code mobile app, the repository picker only showed the first 100 repos of the team's GitHub App installation. Repos that fall past that cap in the cache's stored order (e.g.
billing,chartsfor the PostHog org, which has 500+ repos) were invisible — even though the GitHub App installation has access to them and the desktop / cloud-run picker shows them.Root cause:
apps/mobile/src/features/tasks/api.tsgetGithubRepositoriescalled/api/environments/{projectId}/integrations/{id}/github_repos/with nolimit/offsetand no pagination loop. The backend (posthog/api/integration.py) defaultslimit=100, so only the first page came back. The desktop client (apps/code/src/renderer/api/posthogClient.ts) already pages withlimit=500untilhas_more === false.Changes
apps/mobile/src/features/tasks/api.ts: page throughgithub_repos500 at a time, accumulating untilhas_moreis false. Same shape as the desktop client's loop.How did you test this?
pnpm --filter @posthog/mobile lint— clean.apps/mobileis pre-existing inConversationList.tsxand unrelated.billing/chartsnow appear in the picker for a PostHog-org user.Publish to changelog?
no
Created with PostHog Code