Skip to content

Fix BitBucket Server loading next page after reaching the end of results

What does this MR do and why?

In our Vuex state, we previously set the default value of hasNextPage to true which then kept loading results for the next page when a user scrolled to the bottom. We also did not have any logic to update this and stop the page from sending more network requests.

This MR fixes this logic by changing the default value of hasNextPage to false and only setting it to true when the number of results returned is 25 (aka PAGE_LENGTH).

While this change updates the state for all types of project imports, only GitHub and BitBucket Server actually have pagination and both work as expected (GitHub uses cursor-based pagination which sends pageInfo from the backend).

Changelog: fixed

Screenshots or screen recordings

Before After
BitBucket_Server_before BitBucket_Server_after

How to set up and validate locally

A bit complicated if you really want to test this:

  1. Install BitBucket Data Center from Docker. Be sure to run the commands in Quick Start.
  2. Obtain a trial license for BitBucket: https://confluence.atlassian.com/bitbucketserver/get-a-bitbucket-data-center-trial-license-1188400764.html.
  3. Start and setup your BitBucket instance (username, password) and create at least 1 project + 1 repo.
  4. In GitLab, go to + > New project/repository > Import project > BitBucket Server.
  5. Input your instance URL (should be something like http://localhost:7990), username and password.
  6. On the next page, you should see a list of repos to import. It will look like http://127.0.0.1:3000/import/bitbucket_server/status.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #397679 (closed)

Merge request reports