Lazy fetching of diff view lines
Currently diffs.json
returns lines data for both inline and parallel diff view at the same time.
This makes the JSON bigger, therefore, it takes more time to fetch the data. Also, it doubles the data we store in Vuex store and it's not efficient in terms of performance and memory usage.
We need diffs.json
endpoint to support view
parameter which could be inline
or parallel
and it will only return the respective diff lines by the given parameter.
With this approach, we will need to make another request when we switch the diff view type, but that's something we should do to increase the performance of the MR page. Also, switching diff view mode is not a very common action. Previous implementation before the MR diffs refactor was reloading the page but this new approach will show a spinner while fetching the data. So in the end, it will have better UX compared to old version.