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.19k stars 9.93k forks source link

Blazor Server prerendering with parameters support #14433

Closed javiercn closed 4 years ago

javiercn commented 4 years ago

Right now our customers can create blazor server-side applications but are not able to provide an initial set of parameters for the application to use. This limits the ability to pass in information to the blazor application from the initial component render.

There are many cases where this is useful.

All the infrastructure to support this is already in place. The only missing piece is the ability to serialize parameters into the descriptor that we generate and to deserialize them when the circuit starts and provide them as the initial parameters to the renderer.

javiercn commented 4 years ago

Related issue https://github.com/aspnet/AspNetCore/issues/13721

Ponant commented 4 years ago

Ideally, it would be great to be able to do this, in a Razor Page rather than only in a Razor component <Counter IncrementAmount=2/>

We have an RP based website and now would like to add some blazor components in some of these cshtml RP pages, but we cannot pass in parameters, neither with a tag nor with an anonymous type in RenderComponentAsync (as known here https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/#multiple-components-in-views-or-pages).

Thanks for this feature to come :)

fireinthemountain commented 4 years ago

Support for parameters being passed from MVC views or razor pages would be beneficial to my organization to use Blazor. Hopefully support for server-side parameters will be in 3.1. This definitely caught me off guard with its removal in 3.0.

rynowak commented 4 years ago

Support for parameters being passed from MVC views or razor pages would be beneficial to my organization to use Blazor. Hopefully support for server-side parameters will be in 3.1. This definitely caught me off guard with its removal in 3.0.

Thanks for your feedback. This feature will be back in 3.1

wstaelens commented 4 years ago

Can't use blazor 3.0 without this. When is 3.1 ready?

mkArtakMSFT commented 4 years ago

@wstaelens it'll be some time between late November to early December.

YoanaDimitrova1 commented 4 years ago

I still get System.InvalidOperationException: 'Server components with parameters are not supported.' I am on Version: 3.1.100-preview3-014645.

Is this going to be resolved soon or at all? A lot of us don't want to migrate a whole ASP.NET app to Blazor directly but would rather migrate our JScomponents to Blazor components first especially since WebAssembly Blazor is not production ready untill at least March next year.

Am I correct thinking that currently the only way to use Blazor is to migrate an ASP.NET app to Blazor server-side and convert all Razor pages to Blazor pages? Presumably this will allow using Blazor components with parameters?

pranavkm commented 4 years ago

Hi, it looks like you are posting on a closed issue/PR/commit!

We're very likely to lose track of your bug/feedback/question unless you:

  1. Open a new issue
  2. Explain very clearly what you need help with
  3. If you think you have found a bug, include detailed repro steps so that we can investigate the problem

Thanks!