Jump to next unresolved discussion doesn't order the discussions in the same way the UI does in the Changes tab
Summary
The Jump To Next Unresolved Discussion button sometimes jumps to discussions in the wrong order.
Steps to reproduce
The basic problem is that the UI shows the changes based on an unknown algorithm that appears to be something like:
- Order by commit first
- Then alphanumeric by file name
So to set this up, you need multiple commits.
- Create a commit editing a file like
zoo.txt
- Push it to the MR
- Create a new commit editing a file like
animals.txt
- Push it to the MR
-
Make sure you have Diffs Virtual Scrolling EnabledVirtual Scrolling is enabled by default. Please ensure you have not manually disabled it, and are not viewing the MR in single-file mode. - Leave a comment on both files. You can start at the top and work your way down, but it doesn't matter what order you actually leave the comments in.
- Based on the UI display of the files, you should see the comment on
zoo.txt
first when you click theJump To Next
button, then the comment onanimals.txt
- You are actually jumped to the
animals.txt
comment first, then looped back around to thezoo.txt
comment.
Example Project
This happens in any project.
What is the current bug behavior?
The code to sort the discussions is sorting first by filename, then by line number.
This doesn't match the way the files are displayed in the UI.
What is the expected correct behavior?
The order of the discussions to jump through should match the order they appear on the screen.
Output of checks
This bug happens on GitLab.com
Possible fixes
The code that sorts the discussions is in the Notes app Vuex getters. I think it's likely (but not guaranteed) that we'll need to coordinate this sorting algorithm with the UI display that orders the files differently.