Skip to content

Clarify the names of the interactive render modes for Blazor and rationalize with the component tag helper #50636

@danroth27

Description

@danroth27

In .NET 8 we have the following render modes for Blazor components:

  • Static: Static server rendering.
  • Server: Interactive server rendering using the Blazor Server hosting model. Prerendering is enabled by default but can be disabled.
  • WebAssembly: Interactive client rendering using the Blazor WebAssembly hosting model. Prerendering is enabled by default but can be disabled.
  • Auto: Interactive client rendering that starts with Server and switches to WebAssembly once the runtime has been downloaded. Prerendering is enabled by default but can be disabled.

We also have the existing component tag helper that defines its own RenderModes enum:

  • Static: Static server rendering.
  • Server: Interactive server rendering using the Blazor Server hosting model. No prerendering.
  • ServerPrerendered: Interactive server rendering using the Blazor Server hosting model with prerendering.
  • WebAssembly: Interactive client rendering using the Blazor WebAssembly hosting model. No prerendering.
  • WebAssemblyPrerendered: Interactive client rendering using the Blazor WebAssembly hosting model with prerendering.

One problem with the current naming scheme is that "Server" is a bit ambiguous and confusing. Both the Static and Server render modes render from the server, so it's not immediately clear what the "Server" render mode means.

We could clarify this by renaming Server to something more specific, like InteractiveServer. If we do that, we presumably should to rename the other interactive render modes for consistency:

  • Server -> InteractiveServer
  • WebAssembly -> InteractiveWebAssembly
  • Auto -> InteractiveAuto

Note that this also impacts the APIs used to configure and enable these render modes: AddServerComponents() -> AddInteractiveServerComponents(), etc.

The RenderMode enum used by the component tag helper has already shipped. If we change names of the new render modes, then they will be inconsistent with the existing enum. So, we need to decide if we care more about clarity with the new API or consistency with the existing ones. The new names are also more verbose.

Metadata

Metadata

Labels

area-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions