question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make it easy to transition from stateful prerendering to -> non-stateful prerendering

See original GitHub issue

I think we need to come up with a strategy or some diagnostics to help people migrate from the preview 7 template to the preview 8 one.

Since we’re removing stateful prerendering, there are two changes you need to make in your app:

  • In _Host.cshtml use RenderStaticComponentAsync
  • In Startup.cs add a mapping for the component to the <app> element

Before

app.UseEndpoints(endpoints =>
{
    endpoints.MapBlazorHub();
    endpoints.MapFallbackToPage("/_Host");
});

After

app.UseEndpoints(endpoints =>
{
    endpoints.MapBlazorHub<App>("app");
    endpoints.MapFallbackToPage("/_Host");
});

The problem is that it’s really easy to get the first one of these right - but once you do, the app stops responding. You’ll prerender just fine, but no websocket will be opened. There are literally NO diagnostics telling you that you forgot to do the second part of this.

We need to consider whether we have any good ideas to help people understand how to update preview 4->preview 8

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
stavroskasidiscommented, Jul 30, 2019

You must also consider multiple “entry point” components for existing MVC/Razor pages projects. For example:

I have a razor page Index.cshtml, and I want to render a component in there, for example

<counter>@(await Html.RenderStaticComponentAsync<Counter>())</counter>

while having a second page called Whatever.cshtml, in which I want to render a different component in there, like:

<whatever-component>@(await Html.RenderStaticComponentAsync<WhateverComponent>())</whatever-component>

Currently in preview 7 everything works fine when using

endpoints.MapBlazorHub();

How will this work after the changes ?

1reaction
stavroskasidiscommented, Aug 1, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove stateful prerendering #12245 - dotnet/aspnetcore
We should remove the functionality for stateful-prerendering from the server. We're not recommending it for use in any production scenario, and ...
Read more >
how to stop rendering twice (for non-data retrieving ...
I have some variables that initialize in the code segment in a razor page and they are initializing twice when I started doing...
Read more >
Server-Side Rendering (SSR) - byby.dev
SSR strategy can be stateful or stateless. Stateless server is more easily scalable because there is no per-client page data kept in the ......
Read more >
Improve SEO of OutSystems reactive apps with prerendering
In this article, we describe how you can integrate the OutSystems platform with a third-party pre-rendering solution called prerender.io.
Read more >
Transitioning from Prerender to Server-Side Rendering for ...
The concept of prerendering is essentially employing a headless browser to crawl client-side-rendered web pages in order to obtain their static ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found