Sorting of Issues is wrong in lists with pagination
Summary
On the issue board, the order of a list with too many issues to be loaded at once (in my case, 45) can be wrong.
Steps to reproduce
- On the issue board, remove all lists.
- Create an issue that you move to the very last position. Call it "Debug - Last Issue". If you can, check the database to verify that this issue actually has the highest value of
relative_position
:
sudo gitlab-rails dbconsole
SELECT id, title FROM issues ORDER BY relative_position DESC LIMIT 1;
- Create a list with 45 issues, including the last one.
- Open the issue page through the menu, and scroll down in the list. "Debug - Last Issue" will not be at the bottom.
- Having scrolled down, refresh the page and scroll down again. Now "Debug - Last Issue" is at the bottom.
Example Project
What is the current bug behavior?
The order of issues is different (wrong order) when the page is initially loaded and when the page is refreshed after you scroll all the way down (right order).
What is the expected correct behavior?
The order is always right, according to relative_position
in the database.
Relevant logs and/or screenshots
Side-by-side comparison of the wrong and right behavior, achieved using the steps described above:
Output of checks
Results of GitLab environment info
Results of GitLab application Check
Possible fixes
Definitely a frontend issue.
The problem could be here: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/boards/components/board_list.js#L63
Pages are loaded in order, but may be finished in a different order. If the issues are not resorted after they are received, this might be the root of the problem.