Why is there a "Loading..." delay for every razor page navigation in a Blazor Webassembly application?

Viewed 825

I have a Blazor Webassembly PWA application with two razor pages: Index.razor and History.razor. Every time a user navigates between the two pages, there is a short delay where the "Loading..." HTML is displayed on the page before the app loads the actual razor page.

I understand that when you first open the app in your browser it needs to download all the necessary assemblies and load them. But once they've navigated to site, why does each navigation require that the "Loading..." html be shown? It's often a short period of time (I have my service worker caching everything), but as a user this would feel distracting to me.

I haven't been able to find anything online explaining this. I'm sure I'm probably missing how this actually works, or maybe I have setup my page/navigation incorrectly? Any information on this would be greatly appreciated. How does the page loading work with each navigation? Is there a way to prevent this?

UPDATE: Using the the Blazor WebAssembly template in Visual Studio as an example and following Mister Magoo's comment, I was able to figure out that the reason the "Loading..." shows up is because I am doing a full reload of the pages. That leads me to one last question. If the user is currently on the Index page, and they click to navigate to Index, is there a way to clear out all the Models on that page without forcing a refresh?

1 Answers
Related