To make pages load in an instant the answer - the resulting html - must already be known.
To know the resulting html of a page requires you to cache it ahead of time.
To catch the rendered html of page content go like this:
Use blazorserverside (/appli/)
/appli/ViewModel/rootid/CACHETHIS
This will try to post to a viewmodel in your model called SysCacheCapture , must be unrooted, must be RestAllowed
In SysCacheCapture ViewModel we will try and populate 3 string columns:
- rootid
- viewmodel
- html
In the unrooted SysCacheCapture ViewModel consider if you need a new object - or try and find an existing object to hold the html cache.
The html will be page content - including the left side - excluding the top menu.
Images/blobs with ViewModel specific links will not work - you should cache pages that points to images by urls
Actions will render but not work - since there is no backing logic in the pure html.
How to use the cached html
You can use the cached html anyway you see fit - but one built in way is to use this:
/appli/ViewModel/rootid/FROMCACHE
This will do the following:
httpClient.GetStringAsync($"{baseurl}/Rest/SysCacheGet/Get/$null$?vTheId={id}&vTheViewModel={name}")
IE assume there is an un-rooted Rest enabled ViewModel called SysCacheGet that looks up the cached html in your data and renders it under the main menu of the ServerSide blazor app.
Since the Blazor app skips all the normal rendering and associated datafetch the page returns much faster that it would otherwise.
A merge model with the sample above is available on git hub(https://github.com/supportMDriven/MDrivenComponents): \MDrivenMergeable\InstantPageLoader\