[PoC] When following a link to a MR Diff discussion, avoid rendering the entire MR before displaying the respective Diff File
Problem to solve
When you follow a link to a discussion on a Diff, the entire MR has to render (potentially load several batches before reaching the desired file) before the browser can jump to the right discussion.
Why can't we prioritise the loading of the respective file that has that discussion and only show that, to start? If we provide a way to "render full MR", it should be a much quicker and tuned experience for the goal they're tring to achieve ("read this one comment on this one MR").
This is how they do it on imgur.com, for example:
Link: https://imgur.com/gallery/JxsCE/comment/576492321
Intended users
- Delaney (Development Team Lead)
- Sasha (Software Developer)
- Devon (DevOps Engineer)
- Sidney (Systems Administrator)
- Sam (Security Analyst)
- Rachel (Release Manager)
- Alex (Security Operations Engineer)
- Simone (Software Engineer in Test)
- Allison (Application Ops)
- Priyanka (Platform Engineer)
- Dana (Data Analyst)
(Anyone who uses MRs, really)
User experience goal
Reduce the time from clicking the link of a MR Diff Discussion to displaying the desired comment.
Proposal
When you follow the link to a discussion, like:
https://gitlab.com/andr3/meet.andr3.net/-/merge_requests/24/diffs#note_363714858
363714858
is the note.id
(in the store: notes.discussions[n].notes[n].id
screenshot)
In it, we can look into diff_file
to get the relevant file.
@iamphill suggested we can use the array in the diffs_metadata.json
call and figure out which "page" of diffs_batch.json
to request from the server.
UI proposal
Further details
Another aspect to consider is whether this could enable the file-by-file mode.
Documentation
- We'll probably need to revise screenshots of the Discussions section.
- Also add one for this particular behaviour.
Availability & Testing
The switch to "load all files" should definitely be tested.
What does success look like, and how can we measure that?
The aforementioned time will decrease.
More specifically, "time to discussion shown", from render.
Note: we shouldn't compare time from click as network timings will affect the result.
Is this a cross-stage feature?
This only applies to Diffs but might be worth double checking the Discussion tab and the Issues are unaffected. (devopsplan).