Skip to content

[release/8.0-preview7] [Blazor] Support for determining the render mode dynamically #49578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 21, 2023

Conversation

MackinnonBuck
Copy link
Member

@MackinnonBuck MackinnonBuck commented Jul 21, 2023

Support for determining the render mode dynamically

Adds basic support for using the "Auto" render mode in Blazor apps. This allows the render mode for a component to resolve to either "Server" or "WebAssembly" depending on whether the WebAssembly runtime is downloaded and available on the client.

Backport of #49477

Description

In full-stack Blazor apps, components can be made interactive either via "WebAssembly" or "Server" render modes. The WebAssembly render mode has the advantage that it consumes fewer server resources, but the disadvantage that it delays "time to interactivity" because .NET WebAssembly runtime resources must be downloaded to the client first. Therefore, the "auto" render mode was introduced so that it:

  • Uses the WebAssembly render mode if the client already has the WebAssembly bits cached
  • Uses the Server render mode in other cases, while downloading WebAssembly resources in the background

We also intend to add support for customizing the policy that determines which render mode "auto" mode should resolve to, but that's not included as part of this PR.

Before this change, attempting to use the "auto" render mode would result in an error in the browser console and an unusable app. This PR allows customers to start experimenting with auto mode for their apps.

Fixes #46397

Customer Impact

Medium. The Auto render mode is already one of the three render modes customers can pick, but currently it just breaks the app. As we get closer to GA, we expect lots of customers to start trying out auto mode, so we'd like this feature to be made available as soon as possible so we can collect feedback and make the necessary corrections.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

This feature shouldn't impact functionality for existing Blazor Server/WebAssembly apps. It won't introduce a regression in the existing auto mode implementation, because the current implementation throws an exception.

Verification

  • Manual (required)
  • Automated

@MackinnonBuck MackinnonBuck requested a review from a team as a code owner July 21, 2023 19:32
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Jul 21, 2023
@mkArtakMSFT mkArtakMSFT added the Servicing-consider Shiproom approval is required for the issue label Jul 21, 2023
@ghost
Copy link

ghost commented Jul 21, 2023

Hi @MackinnonBuck. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

Copy link
Contributor

@mkArtakMSFT mkArtakMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as the original PR was reviewed and approved.

@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Jul 21, 2023
@ghost
Copy link

ghost commented Jul 21, 2023

Hi @MackinnonBuck. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@mkArtakMSFT mkArtakMSFT merged commit a5d9796 into release/8.0-preview7 Jul 21, 2023
@mkArtakMSFT mkArtakMSFT deleted the mbuck/auto-mode-preview-7 branch July 21, 2023 22:59
@ghost ghost added this to the 8.0-preview7 milestone Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants