Recently in Blazor I discovered that using a RenderMode of ServerPrerendered in conjunction with calling initial data in OnInitializedAsync causes OnInitializedAsync to be called twice. This causes a brief UI flash, and if I'm not pulling data from cache and straight from the database, a extra db call is made, no bueno. So I switched to using OnAfterRenderAsync and calling only when firstRender is true. This takes care of the extra call and doesn't have a UI flash, it feels nicer. However there is brief moment where not the entire page has rendered, and I'm waiting for it to load. What I would like to implement is a loading bar at the top of the page to indicate load progress, similar to what YouTube does.
I was wondering which life cycle events from the moment a hyper link is clicked to the page being rendered I need to use to make this happen? I am also assuming that I will need to use a Singleton AppState to track the load progress based on some current value over a total value to generate the bar completion progress percent.
I think I know what do do and I'm starting to try it, but I was wondering what other solutions you guys have come up with in Blazor? Any tips or suggestions?