Skip to content

Use cached highlighted diff when presenting discussions on Merge Request page

It's viable to reuse cached highlighting information when viewing diff discussions of the "current version" diff. This should probably allow loading the main Merge Request page quicker, as we don't have to send a comparison request to Gitaly for each discussions separately.

Old description:

This is pretty much related to https://gitlab.com/gitlab-org/gitlab-ce/issues/43951. We also send N+1 RPC requests when opening a merge request page.

As on https://gitlab.com/gitlab-org/gitlab-ce/issues/43951, this happens because we send a method call to Gitlab::Diff::File before collecting all the records, hence https://gitlab.com/gitlab-org/gitlab-ce/blob/5509fb9e0b0bd0025e30c1d3c3c0ff13fafadb98/app/views/discussions/_diff_with_notes.html.haml#L11 forces a premature request to Gitaly without getting a chance to batch the request with Blob.lazy.

Edited by Oswaldo Ferreira