Add streaming to Blame page full view
What does this MR do and why?
Implements Blame page streaming (#385686 - closed).
Please refer to HTML Streaming (gitlab-org/frontend/rfcs#101) in order to get familiar with the concept of HTML Streaming.
This MR adds streaming support to the Blame page full file view. The feature is enabled via a :blame_page_streaming
feature flag.
This MR also changes the styling and layout of the blame file in order to:
- Send less bytes (this is really important for huge blame files)
- Render faster with less selector overhead
New full blame page rendering algorithm
- Render
200
lines initially on the server - When the page starts loading immediately start a request for the next
2000
lines (startup_js
block, lines are server rendered by Rails as well) - When the bundle starts fetch the rest of the lines with
2000
lines per page with a maximum of5
requests at the time - Start rendering the streams (
response.body
providesReadableStream
of the request)
Screenshots or screen recordings
General preview
Screen_Recording_2023-02-02_at_20.40.49
Slow-motion streaming recording
Screen_Recording_2023-01-26_at_16.37.41
How to set up and validate locally
- Run
Feature.enable(:blame_page_streaming)
in Rails console (gdk rails c
) - Open any blame file with more than 2000 lines. (GDK example link, 30KLOC+)
- Click 'View entire blame' button at the bottom of the page.
Performance measurements
(left is streaming with ?streaming=true
, right is full page SSR with ?no_pagination=true
)
Bugs that would be addressed in subsequent MRs
Edited by Stanislav Lashmanov