Skip to content

fix(mobile): paginate github_repos to show all repositories#2118

Open
posthog[bot] wants to merge 1 commit intomainfrom
posthog-code/fix-mobile-github-repos-pagination
Open

fix(mobile): paginate github_repos to show all repositories#2118
posthog[bot] wants to merge 1 commit intomainfrom
posthog-code/fix-mobile-github-repos-pagination

Conversation

@posthog
Copy link
Copy Markdown
Contributor

@posthog posthog Bot commented May 10, 2026

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, charts for 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.ts getGithubRepositories called /api/environments/{projectId}/integrations/{id}/github_repos/ with no limit / offset and no pagination loop. The backend (posthog/api/integration.py) defaults limit=100, so only the first page came back. The desktop client (apps/code/src/renderer/api/posthogClient.ts) already pages with limit=500 until has_more === false.

Changes

  • apps/mobile/src/features/tasks/api.ts: page through github_repos 500 at a time, accumulating until has_more is false. Same shape as the desktop client's loop.

How did you test this?

  • pnpm --filter @posthog/mobile lint — clean.
  • Verified the change visually against the desktop client's pagination pattern; the typecheck failure on apps/mobile is pre-existing in ConversationList.tsx and unrelated.
  • Did not test on a device — would benefit from a quick manual smoke test in the mobile app to confirm billing / charts now appear in the picker for a PostHog-org user.

Publish to changelog?

no


Created with PostHog Code

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
@pawel-cebula pawel-cebula marked this pull request as ready for review May 10, 2026 08:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 10, 2026

Reviews (1): Last reviewed commit: "fix(mobile): paginate github_repos to sh..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants