Skip to content

Commit

Permalink
fix: PR list pagination
Browse files Browse the repository at this point in the history
Signed-off-by: Toma Puljak <[email protected]>
  • Loading branch information
Tpuljak committed Jan 13, 2025
1 parent 87c0469 commit 3fce131
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/cmd/workspace/util/branch_wizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,17 @@ func SetBranchFromWizard(config BranchWizardConfig) (*apiclient.GitRepository, e
curPageItemsNum := 0
selectionListCursorIdx := 0
var selectionListOptions views.SelectionListOptions
prList = []apiclient.GitPullRequest{}

for {
err = views_util.WithSpinner("Loading Pull Requests", func() error {
branches, _, err := config.ApiClient.GitProviderAPI.GetRepoBranches(ctx, config.GitProviderConfigId, url.QueryEscape(config.NamespaceId), url.QueryEscape(config.ChosenRepo.Id)).Page(page).PerPage(perPage).Execute()
prs, _, err := config.ApiClient.GitProviderAPI.GetRepoPRs(ctx, config.GitProviderConfigId, url.QueryEscape(config.NamespaceId), url.QueryEscape(config.ChosenRepo.Id)).Page(page).PerPage(perPage).Execute()
if err != nil {
return err
}

curPageItemsNum = len(branches)
branchList = append(branchList, branches...)
curPageItemsNum = len(prs)
prList = append(prList, prs...)
return nil
})

Expand Down

0 comments on commit 3fce131

Please sign in to comment.