Request Inline or Parallel diffs instead fetching all data from Backend in one request
Feature flag: single_mr_diff_view
(MR)
Problem to solve
The process to generate serialized, highlighted diffs on the Backend is not cheap. Also, it generates big payloads depending on the diff size.
Currently I see we return both highlighted_diff_lines
and parallel_diff_lines
to the FE in the diffs.json
endpoint, and in near future via diffs_batch.json
endpoint. Apparently parallel_diff_lines
is used just for the Parallel view, while the other for the Inline view.
Removing one key or the other from BE reduces the payloads to almost half, also saving considerable time in the serialization process (I've seen 5MB reduced to ~2.5MB at diffs.json
).
Further details
GitLab | Github |
---|---|
Bitbucket Cloud doesn't allow you to change the layout on the fly instead you have to open the side by side view in a modal.
Proposal
Only send the Parallel OR Inline diff in the API response, not both
When switching between either view, reload the page.
Currently, switching is slow for large merge requests and may crash the page, so this will make switching between modes reliable.
For smaller merge requests, this means the user will lose their position on the page. A follow up issue will attempt to address this: