RC2 Blazor Web App template nits and inconsistencies #51495
Labels
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
feature-templates
Milestone
Is there an existing issue for this?
Describe the bug
A few small nits / inconsistencies after creating a new "Blazor Web App" template with the following options

ManageNavMenu.razor
inComponents\Layout
has superfluous;
that can be omitted:In the same file, the private component variable is prefixed with an underscore:



However, in the Weather.razor the underscore-less convention is used:
My personal coding style is: If it is used in the razor template, use a private property, else a private variable with underscore. That way I can distinct private vars only for the code section and vars used in the render template.
RegisterConfirmation.razor is then inconsistent again with no explicit private modifier and no underscore. Same in ResetPassword.razor
StatusMessage.razor
has logic in the razor template. I would avoid doing that and move the code block at the top into OnParametersSet override.In a couple of places OnInitialized sets a Parameter, but OnParametersSet will always override that, I think.

Also in ExternalLoginPicker.razor, LoginWith2fa.razor, LoginWithRecoveryCode.
Unused using and inject in Index.razor in Account/Manage and in PersonalData.razor, Register.razor:

As a side note, I usually move all the usings to the _Imports.razor file so the component files are short and concise.
Two properties in the Error.razor can be made private:

Expected Behavior
Running the template produces concise, correct code
Steps To Reproduce
Run the template as demonstrated above and inspect all the files
Exceptions (if any)
No response
.NET Version
8.0.100-rc.2.23502.2
Anything else?
17.8 Preview 3
The text was updated successfully, but these errors were encountered: