-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Callsite rendermodes #48967
Callsite rendermodes #48967
Conversation
Hi @SteveSandersonMS. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
@SteveSandersonMS do you want to retarget this to preview6? Or will there be a port PR? |
…Mode, and supply it from ComponentFactory
…rmode before calling ResolveComponentForRenderMode
e335c90
to
31efd54
Compare
31efd54
to
e45b03f
Compare
… with the final syntax
@SteveSandersonMS overall looks good. Are we checking at some point that users don't intermingle server/webasembly components? |
Yes, both the server and webassembly renderers reject instructions to render the other type of component. |
Hi @SteveSandersonMS. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed. |
* builder.AddComponentRenderMode API and storage on RenderTree * Extend ResolveComponentForRenderMode to receive callerSpecifiedRenderMode, and supply it from ComponentFactory * Simplify API: collapse the two rendermode sources into a single rendermode before calling ResolveComponentForRenderMode * Corresponding renames * Actually supply callsite rendermode from RenderTree * Give clearer errors if misusing this feature * Build fix * Actually use the parameter name @rendermode for forward-compatibility with the final syntax * Add E2E tests
Add callsite rendermodes for Blazor full-stack web apps
Allows Blazor components to have a rendermode specified at the usage site. Among other use cases, this allows us to simplify the default project template by removing an otherwise pointless wrapper component.
We want to do this in preview 6 (to get customer feedback) but didn't land it in time for the normal code-complete cutoff.
Description
We already support specifying a fixed rendermode on a component type, e.g.:
However, it's commonly also desirable to specify a rendermode at the callsite for a component, e.g.:
This allows the consumer to vary the rendermode according to their own preferences without having to do so on the parent component. In the default project template, it means that developers can have an interactive
<HeadOutlet>
just by writing:... whereas without this change, they have to define some new component e.g., called
AppHeadOutlet
containing just:... and then place
<AppHeadOutlet />
at the intended call site.Fixes #48793
Customer Impact
Allows the default migration experience from Blazor Server/WebAssembly to the new full-stack architecture to be more streamlined and not involve a weird, pointless-seeming wrapper component.
Regression?
[If yes, specify the version the behavior has regressed from]
Risk
Low because this only impacts completely new code using the new functionality. It shouldn't be possible for this to break existing apps.
Verification
Packaging changes reviewed?