Skip to content

Remove stateful prerendering  #12245

Closed
Closed
@rynowak

Description

@rynowak

Summary

Blazor has a feature that I'll refer to as stateful-prerendering where you render a group of components on the server, and then retain that group of components in memory until the client opens a SignalR connection (or it times out).

This currently has some really bad scalability problems, and we think it's not viable for use in production with the current implementation.

However, this is a nicer developer experience than some of the alternatives because a variety of different scenarios just work.

I'm sure that if we had lots of time we could provide a set of complicated knobs and dials that developers could use to try and make this feature viable for their use case and risks, we're out of time to do so. The extra things that stateful-prerendering enables are not on the main path for server-side Blazor, and so it should be cut entirely.

Proposed Template Changes

These changes should take place in Preview 8 so that we can gather feedback

We'll use a different technique to wire up the entry point component in the template.

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

We'll still use prerendering in the template, but we'll call out how to remove it.

    <app>
        @* Remove the following line of code to disable prerendering *@
        @(await Html.RenderStaticComponentAsync<App>())
    </app>

See notes below about RenderStaticComponentAsync

Proposed Product Changes

These changes can take place as late as Preview 9 - but earlier is always better

We should remove the functionality for stateful-prerendering from the server. We're not recommending it for use in any production scenario, and so we should remove the functionality.

The Microsoft.AspNetCore.Mvc.Components.Prerendering package can be removed.

The RenderStaticComponentAsync methods should be renamed to RenderComponentAsync.

Various implementation pieces can be cleaned up as-desired. We can't predict right now if we'll bring back the same feature in the same way, so the cleanest thing to do would be to remove all of the unneeded functionality.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions