🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
InstantPageLoader
This page was created by Hans.karlsen on 2025-09-23. Last edited by Restore-user on 2026-10-21.

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, which must be unrooted and RestAllowed.

In SysCacheCapture ViewModel we will try and populate 3 string columns:

  • rootid
  • viewmodel
  • html

In the unrooted SysCacheCapture ViewModel, consider whether you need a new object or whether you should try to find an existing object to hold the html cache.

Error creating thumbnail: File missing

The html will be page content, including the left side, but excluding the top menu.

Images/blobs with ViewModel specific links will not work; you should cache pages that point 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 in any way 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}")

I.e., 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.

Error creating thumbnail: File missing

Since the Blazor app skips all the normal rendering and associated data fetch, the page returns much faster than it would otherwise.

A merge model with the sample above is available on GitHub (https://github.com/supportMDriven/MDrivenComponents): \MDrivenMergeable\InstantPageLoader\