MR diffs file count increments while batch loading
Summary
When using batch uploading the file count increments with each batch coming in. It should stay static with the total number of files from the start.
For example: If the MR has 80 total files the page will start with 0 files, then increment to 20, 40, 60 and finally 80. It should start out at 80 on the initial load.
Steps to reproduce
With batch-diffs enabled go to any MR with more than 20 affected files.
Example Project
Running the GDK locally use this one http://localhost:3000/Commit451/lab-coat/merge_requests/2/diffs
Warning: It's big and will take a while to load.
What is the current bug behavior?
File count increments.
What is the expected correct behavior?
File count stays static.
Relevant logs and/or screenshots
Possible fixes
The file count comes from this getter in app/assets/javascripts/diffs/store/getters.js
export const diffFilesLength = state => state.diffFiles.length;
Suggest changing to grabbing the total first if available.
Note: totalFiles
is just a place holder here. It needs to be retrieved elsewhere. Also this may not be the best place. We only use diffFilesLength
in one place. I don't think we really need a getter here. Maybe just pass through as a prop directly to app/assets/javascripts/diffs/components/compare_versions.vue
export const diffFilesLength = state => totalFiles || state.diffFiles.length;