-
Notifications
You must be signed in to change notification settings - Fork 200
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
Support null @rendermode #9343
Comments
@SteveSandersonMS @danroth27 @chsienki @jaredpar I think we're going to need to update the razor compiler to allow a null
|
Is that not just the underlying API needs the annotation applied to it to allow a nullable type? |
Yeah I would have thought so. Not sure why a compiler change would be required, but if @halter73 knows it is, please clarify! |
I've updated I'm not 100% sure why this still leads to CS8600 warning, but could it because the code generator is still attempting to treat the IComponentRenderMode as non-nullable? For example: Line 84 in 4258f88
Or does |
@halter73 Ah you're right, its because we do the double assign to avoid side effects that this crops up. We can either make this nullable too (seems correct, if the underlying API is nullable) or not emit in the case of |
Do we need to be concerned about |
I'm pretty sure you can rely on it being a class, but I'll defer to @SteveSandersonMS. |
Just appending |
## Description This PR addresses a large amount of feedback from #50722 which was merged before they could all be addressed to unblock Accessibility Testing effort. The primary impacts are: #### Runtime changes - Public API change to make `AddComponentRenderMode`'s `renderMode` param nullable to support disabling interactivity on a per-page basis with the help of `@rendermode="null"` (effectively). - **IMPORTANT:** This will need follow up in the Razor Compiler. See dotnet/razor#9343 - API Proposal issue: #51170 - This is a e necessary to support the changes to add global interactivity to Identity components @SteveSandersonMS made in #50920 and have now been included in this PR. - [Add antiforgery token to forms rendered interactively on the server](425bd12) - This bug fix is necessary to make the logout button work without throwing antiforgery errors when it is rendered interactively on the server. #### Template changes - Fix compilation error due to missing `using` in `Program.cs` when the individual auth option is selected with no interactivity. - Add support for global (`--all-interactive`) instead of just per-page interactivity to the new Identity components. - Fix "Apply Migrations" link on the `DatabaseErrorPage` by calling `UseMigrationsEndPoint()` when necessary. - Add support for non-root base paths to the new Identity components. - Improve folder layout by putting most of the additional auth and Identity related files in the same /Account folder. - Use the new `IEmailSender<ApplicationUser>` API instead of `IEmailSender` for easier customization of emails. - Remove usage of `IHttpContextAccessor` from the template because that is generally regarded as bad practice due to the unnecessary reliance on `AsyncLocal`. - Remove underscore (`_`) from private field names. - Reduce usage of `null!` and `default!`. - Use normal `<button>` for logout link in nav bar rather than `<a onclick="document.getElementById('logout-form').submit();">`, and remove separate `LogoutForm.razor`. ## Customer Impact This fixes several bugs in the Blazor project template when choosing the individual auth option and makes several runtime fixes that will be beneficial to any global interactive Blazor application that needs to include some components that must always be statically rendered. ## Regression? - [ ] Yes - [x] No ## Risk - [ ] High - [ ] Medium - [x] Low Obviously, we would rather not make such a large change after RC2. Particularly when it's a change that touches public API. Fortunately, the runtime changes are very small, and only to parts of the runtime that were last updated in RC2 (see #50181 and #50946). The vast majority of the changes in the PR only affect the Blazor project template when the non-default individual auth option is selected. This was merged very late in RC2 (#50722) with the expectation that we would make major changes prior to GA. ## Verification - [x] Manual (required) - [x] Automated ## Packaging changes reviewed? - [ ] Yes - [ ] No - [x] N/A
Yes, I think you're right, and this is going to affect dotnet/aspnetcore#50920 (Auth with global interactivity) because it's exactly how we're most likely going to do it. cc @halter73
The reason it worked in my PR is probably that it didn't yet have the Razor compiler changes for
@rendermode
and hence was behaving as a regular attribute that gets elided if you passnull
. We can changeAddComponentRenderMode
in the runtime to treatnull
as a no-op.Originally posted by @SteveSandersonMS in dotnet/aspnetcore#51031 (comment)
The text was updated successfully, but these errors were encountered: