Add server-side branch prefix search#110
Conversation
Uses GraphQL refs query with query variable for prefix filtering and cursor-based pagination instead of fetching all branches client-side.
Greptile SummaryThis PR replaces the REST-based
Confidence Score: 4/5The core implementation is functionally sound for basic search use cases, but the accepted The GraphQL query correctly fetches branches with optional search filtering and returns a flat array. However, the Both Important Files Changed
Reviews (9): Last reviewed commit: "revert pagination" | Re-trigger Greptile |
| return array_values(array_map(fn ($branch) => $branch['name'] ?? '', $responseBody)); | ||
| $edges = $refs['edges'] ?? []; | ||
| $pageInfo = $refs['pageInfo'] ?? []; | ||
| $hasNext = (bool) ($pageInfo['hasNextPage'] ?? false); | ||
|
|
||
| return [ | ||
| 'items' => array_map(fn ($edge) => $edge['node']['name'] ?? '', $edges), | ||
| 'hasNext' => $hasNext, | ||
| 'nextCursor' => $hasNext ? ($pageInfo['endCursor'] ?? null) : null, | ||
| ]; |
There was a problem hiding this comment.
Keep old response structure - no hasNext, no cursor
| if ($page > 1) { | ||
| for ($i = 1; $i < $page; $i++) { |
| /** | ||
| * @return array{names: array<string>, endCursor: string|null} | ||
| */ | ||
| private function fetchBranchPage(string $owner, string $repositoryName, int $perPage, ?string $after, string $search): array |
Uses GraphQL refs query with query variable for prefix filtering and cursor-based pagination instead of fetching all branches client-side.