Render merge request file tree before waiting for `diffs.json`
Problem to solve
When I open a merge request to perform a code review, I want to be able to immediately judge the size and scope of changes that I will need to review, so that I can adjust my expectations if the change is huge and quickly update my colleagues who might be waiting on my review.
The list of files changed, and number of lines added or removed, is not available until the entire diff is loaded.
This important information should be loaded early to give the user feedback about how large the merge request is, and why the diff might be taking a while to load.
In the future, this would also provide the foundation for only loading the first file in a file-by-file mode https://gitlab.com/gitlab-org/gitlab-ce/issues/40844
Further details
This was a finding of the discovery sprint https://gitlab.com/gitlab-org/gitlab-ce/issues/62536
Proposal
- Create a new diff stats API that includes the list of files changed/renamed, and the number of lines changed
- Use the new API for rendering this information in the merge request for rendering the file tree so that the Changes tab shows useful information sooner!
- FE will show a “skeleton” loader like Web IDE until file tree data is available:
Measuring success
TTFB should be less than 200ms for the diff stats endpoint.
This change is being made in coordination with &1816 which will improve performance of the merge request interface, and provide the foundation for reducing the frequency with which diff limits are hit https://gitlab.com/gitlab-org/gitlab-ce/issues/66638.