dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

Consider a React Server Components-like Blazor hybrid #29577

Closed leebenson closed 1 year ago

leebenson commented 3 years ago

React is experimenting with Server Components.

They allow certain components to run on the server while others remain on the client, and serialise state/DOM updates back to the client.

The headline benefits are:

The parallel with Blazor is akin to running WebAssembly + Blazor Server at once. Components run on the client by default, but if they're designated to be server components, they would run remotely, and patch the DOM over a SignalR circuit.

I think this paradigm could have tremendous benefits for Blazor beyond pre-rendering. Namely:

There are some trade-offs with this feature:

  1. Props passed to Blazor Server Components would need to be serialisable over the network. In React, that's typically scalar values and other types that can be represented with JSON.

  2. Like Blazor Server, it'd only work with a hosted model. This is pretty obvious, of course-- it's a direct replacement in many scenarios for prerendering.

  3. It'd have the same 'expense' as Blazor Server for persisting connections and managing state. But unlike Blazor Server, what's designated to run on the server would be opt-in-- not all-or-nothing.

Overall, I think this would be a significant win for Blazor. I can think of plenty of ways I could put this to use!

javiercn commented 3 years ago

@leebenson thanks for contacting us.

We are already looking at things like this as part of https://github.com/dotnet/aspnetcore/issues/29577

ghost commented 3 years ago

Thanks for contacting us. We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

jotosmurf commented 3 years ago

We are already looking at things like this as part of #29577

@javiercn you accidentally mentioned this issue instead of referencing another one :-)

ghost commented 3 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

RChrisCoble commented 2 years ago

Hello @danroth27, We would benefit from this concept as well for our Use Cases.

ghost commented 2 years ago

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

mkArtakMSFT commented 1 year ago

Closing as we are taking the Blazor United approach which is going to address the same problems: https://github.com/dotnet/aspnetcore/issues/46636