dotnet / dotnet/aspnetcore

Transfer component state from server component to client component

Open
#50,835 3 comments 2 reactions 0 assignees View on GitHub
area-blazor enhancement feature-full-stack-web-ui Pillar: Complete Blazor Web Priority:2 triaged
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

When using RenderingMode = Auto in ASP.NET 8.0 Blazor components, interactivity is handle by the server if the client assembly (wasm) is not yet available at the client. This approach can be used to avoid loading delays at the client side for WebAssembly enabled components. The problem is that the component rendering and interactivity will not switch to the client wasm even after this is loaded, unless the component is refreshed.

### Describe the solution you'd like

An idea on how to enforce client wasm rendering immediately after the assemblies get downloaded by the browser is to enable transfer of the component state from server to client, and hence force the switch without affecting the client.

There might be cases which the opposite might be useful as well. An example is to transfer the state back to the server when we detect an update to the client assemblies and would like to seamlessly force the update to the client. In such case the client can transfer the state to the server, switch the renderingmode to server, download the updated wasm binaries and switch back to client.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.