Skip to content

RC2 Blazor Web App template nits and inconsistencies #51495

@rogihee

Description

@rogihee

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

A few small nits / inconsistencies after creating a new "Blazor Web App" template with the following options
image

  1. ManageNavMenu.razor in Components\Layout has superfluous ; that can be omitted:
    image

  2. In the same file, the private component variable is prefixed with an underscore:
    image
    However, in the Weather.razor the underscore-less convention is used:
    image
    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
    image

  3. StatusMessage.razor has logic in the razor template. I would avoid doing that and move the code block at the top into OnParametersSet override.
    image

  4. In a couple of places OnInitialized sets a Parameter, but OnParametersSet will always override that, I think.
    image
    Also in ExternalLoginPicker.razor, LoginWith2fa.razor, LoginWithRecoveryCode.

  5. Unused using and inject in Index.razor in Account/Manage and in PersonalData.razor, Register.razor:
    image
    As a side note, I usually move all the usings to the _Imports.razor file so the component files are short and concise.

  6. Two properties in the Error.razor can be made private:
    image

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

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-templates

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions