Resolve "Link to file in Changes tab of MR no longer works for all files after incremental rendering improvement"
What does this MR do?
When following a link to one of the last line of changes of an MR, which wouldn't be rendered right away but incrementally, using a queue, the jump would fail since the element wasn't on the page by the time the check is run; it was still being processed.
Thus, this MR implements the following strategy:
- Still do the check at the usual moment: this is to promote perceived performance and jump as early as possible, in case it's one of the first lines.
- If not present, it sets a listener so that when the queue is done processing, it checks again whether the current hash now has a corresponding element on the DOM. Only checks one. No polling.
Note it also includes a commit that makes the offset when following a link account for the performance bar, which causes some nuisance while developing or when a user has the Performance Bar enabled.
To test
- Open an MR with more than 2000 lines of changes
- Scroll down on the Changes tab
- Click on the line number of one of the last files visible, without clicking expanding
- Refresh
- Wait for the entire page to load. You should be taken to it, after a few seconds.
What are the relevant issue numbers?
Closes #50347 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides
Edited by André Luís