Skip to content

Auto switching for interactive components #46397

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

Closed
mkArtakMSFT opened this issue Feb 1, 2023 · 1 comment · Fixed by #49477
Closed

Auto switching for interactive components #46397

mkArtakMSFT opened this issue Feb 1, 2023 · 1 comment · Fixed by #49477
Assignees
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-full-stack-web-ui Full stack web UI with Blazor Priority:1 Work that is critical for the release, but we could probably ship without
Milestone

Comments

@mkArtakMSFT
Copy link
Contributor

mkArtakMSFT commented Feb 1, 2023

In scope:

  • Use Server by default while loading WebAssembly runtime in the background
  • If WebAssembly files are cached, use WebAssembly mode

Out of scope:

@mkArtakMSFT mkArtakMSFT added enhancement This issue represents an ask for new feature or an enhancement to an existing one area-blazor Includes: Blazor, Razor Components Priority:1 Work that is critical for the release, but we could probably ship without feature-full-stack-web-ui Full stack web UI with Blazor labels Feb 1, 2023
@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Feb 1, 2023
@juepiezhongren
Copy link

Does auto mode support automatic switch besides re-ender switch?

mkArtakMSFT pushed a commit that referenced this issue Jul 21, 2023
…de dynamically (#49578)

# 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
- [X] No

## Risk

- [ ] High
- [ ] Medium
- [X] 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

- [X] Manual (required)
- [ ] Automated
@ghost ghost locked as resolved and limited conversation to collaborators Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-full-stack-web-ui Full stack web UI with Blazor Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants