Improve Rapid Diffs performance on view settings change
What does this MR do and why?
This MR improves client-side Rapid Diffs performance when changing view settings.
Previously we changed the opacity on the diffs list root element. This caused a very expensive style recalculation due to attribute mutation when lots of diffs were rendered on the page.
To solve that we create an overlay element alongside the diffs list, which will dim the diffs list when we change view settings and reload diffs. Changing attributes on this element will not cause style recalculation on the diffs list.
Screenshots or screen recordings
| Before | After |
|---|---|
|
|
How to set up and validate locally
- Enable
rapid_diffsandrapid_diffs_on_mr_showfeature flags - Go to any large merge request (more than 100 files/1000 lines changed)
- Select 'Changes' tab
- Add
?rapid_diffs=trueto the URL, follow it - Open view preferences
- Select 'Show whitespace changes'
- Observe no lag (alternatively: profile this using DevTools performance tab)

