Use diff metadata to find out when to send diff-files-end performance mark
What does this MR do?
This MR is making a non-user-facing change on the MR diff page (/group/project/-/merge_requests/1/diff
).
This MR is going to fix #293039 (closed)
We wanted to trigger the mr-diffs-mark-diff-files-end
when we fetch all diff items in the MR diff view. But instead we were triggering the mark with every batch of items that we fetched.
We were using state.diffs.length
to find out whether the index
of a diff item is the last of all diffs. But the state.diffs.length
doesn't reflect the total, but only the number of currently
fetched items. This change uses diffFilesLength
instead, which is
taken from the diff metadata and reflects the total number of changed
files.
batch | # of fetched items (state.diffs.length) | total # of diff items (diffFilesLength) | should trigger mark? |
---|---|---|---|
1st | 40 | 87 | |
2nd | 80 | 87 | |
3rd | 87 | 87 |
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #293039 (closed)