Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blank page in prerender on switching between pages from different areas with custom main layout in .net 9 Blazor

$
0
0

What I have:

  1. A static server authentication area implemented as described here
  2. An interactive server rest of the app with App.razor configured like this:

...

...<HeadOutlet @rendermode="RenderModeForPage" /></head><body><Routes @rendermode="RenderModeForPage" /><script src="_framework/blazor.web.js"></script><script src="@Assets["lib/bootstrap/dist/js/bootstrap.min.js"]"></script></body></html>@code{    [CascadingParameter]    private HttpContext HttpContext { get; set; } = default!;    private IComponentRenderMode? RenderModeForPage =>    HttpContext.Request.Path.StartsWithSegments("/Auth")        ? null        : new InteractiveServerRenderMode(prerender: false); --> prerender:false make the blank screen appear before rendering the page components}
  1. Authentication area has its own layout which uses MainLayout

Every time I navigate between these 2 areas (ex: from Login page to Counter page) a blank white screen is shown for 2-5 seconds (depending of what calls I make in OnInitializedAsync - db calls etc.) before the actual page start to be rendered --> this behavior (the blank page part) is produced by new InteractiveServerRenderMode(prerender: false); --> prerender:false from App.razor

With no (prerender: false) - those 2-5 seconds in navigation between areas show the current page that was rendered before I click for navigation to other page, though the link is changed to the the one where I navigate to.

The main thing is that navigation between these 2 different rendering mode areas generates this behavior.

Is this a normal thing? Am I doing something wrong? A kind of similar thing was reported here


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>