Ingest the single diff file diff endpoint into the Diffs app
What does this MR do and why?
This MR adds the diff_for_path
endpoint to the Diffs app by printing it into the DOM from the merge request helper and ingesting that value into the Vue app.
Why
Context
For #337263 (closed).
We are making File-by-file view mode much more useful by only fetching the single file that you are trying to view at any time.
In extreme cases, if the file you are viewing is the last in a long list (say 100s or 1000s of files), batch-loading the diffs could introduce an extremely noticeable delay before your single file is loaded and displays while the app loads tons of files you have no interest in.
The above issue - and this chain of MRs - will resolve that problem by loading only the file needed to display.
Specifics
To load a single file, we need an API endpoint to load a diff for one file.
This endpoint exists, but we need access to it on the front end.
This MR adds the endpoint to the Rails output and ingests it into the Vue app when it starts up.
Roadmap
This MR is one of a set of changes that will eventually implement this feature.
Status | MR | Purpose |
---|---|---|
We are here! |
!112515 (merged) | Adds the API access we need for the more surgical data |
|
!112516 (merged) | Switches to using our initial metadata representation of the MR for many operations |
|
!111895 (merged) | Adds the feature that will only load the proper file when necessary to display it |
Screenshots or screen recordings
N/A, all back stage.
How to set up and validate locally
- Visit an MR Changes tab (Diffs)
- In the HTML source of the page, find the attribute
data-endpoint-diff-for-path
. This is the new value.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.