Skip to content

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)

Est_numquam_nostrum_ut_perspiciatis_iusto_officiis_et____1____Merge_Requests___Gitlab_Org___Gitlab_Shell___GitLab

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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)

Merge request reports