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

Add InteractiveServer page to InteractiveAuto webapp

$
0
0

I have created a Blazor webapp which was created using Auto interactivity (and individual authentication). Working to add to the webapp I have understood that InteractiveAuto means using InteractiveServer and then InteractiveWebAssembly once the page is passed to the client. This has worked great so far.

Now I want to add a couple pages which pull data from a sqlite database and plot it. Since I do not want to query and then send all the data to the client and have the webassembly parse and plot the data, I was hoping to have these pages use Interactive Server rendering.

I verified the only place where the rendermode is being set is in the App.razor file in the server project. I have added the pages to the server project, and made sure the rendermode is being set to InteractiveServer in the App.razor file.

The issue is I can see the pages being pre-rendered, and then I see the white "not found" page. Therefore, blazor is trying to render the page using InteractiveAuto, when the only place render mode is being set explicitly is in the App.razor file where I explicitly set the rendermode to InteractiveServer for those routes.

Here is my entire App.razor file, the only place render mode is being set explicitly:

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><base href="/" /><link rel="stylesheet" href="bootstrap/bootstrap.min.css" /><link rel="stylesheet" href="app.css" /><HeadOutlet @rendermode="RenderModeForPage" /></head><body><Routes @rendermode="RenderModeForPage" /><script src="_framework/blazor.web.js"></script></body></html>@code {    [CascadingParameter]    private HttpContext HttpContext { get; set; } = default!;    private IComponentRenderMode? RenderModeForPage    {        get        {            if (HttpContext.Request.Path.StartsWithSegments("/Account")) return null;            else if (HttpContext.Request.Path.StartsWithSegments("/Synthesis")) return InteractiveServer;            else return InteractiveAuto;        }    }}

So my main question is when I have a webapp which seems to be using InteractiveAuto rendering by default, how can I add pages that use InteractiveServer rendering?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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