Aspnetcore: Blazor Server prerendering with parameters support

Created on 25 Sep 2019  路  8Comments  路  Source: dotnet/aspnetcore

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.

  • Passing per-user initialization information.

    • We get a lot of request from customers about this and there is not an easy solution, passing parameters to the top level components would solve that.

  • Setting up initial context.

    • Being able to pass initial values for the theme of the application would be an example.

  • Rendering multiple components into a page.

    • This would be useful in scenarios where users are building rich reporting experiences with interactive charts and similar components.

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.

Done area-blazor enhancement

Most helpful comment

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

All 8 comments

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 :)

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.

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

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

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

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?

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!

Was this page helpful?
0 / 5 - 0 ratings