Skip to content

Blazor InputSelect does not select the value when using SSR #53167

@sikora507

Description

@sikora507

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I've been following input components documentation: https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/input-components?view=aspnetcore-8.0

And I've created the application with starship form page:
image

After I provide all values and submit the form, the "Primary Classification" InputSelect component clears it's value, and when I try to click the Submit button again, I get the validation error. But the rest of the values are preserved. Only the one from InputSelect is cleared out.

The InputSelect component looks like this, straight from the docs:
image

The Submit method logs the values properly and I can see the Classification that i've selected.
image

But after the first post, the selected value is cleared.

I've provided the demo app on github:
https://github.com/sikora507/blazor-selectinput-issue

The issue does not occur when I use
@rendermode InteractiveServer

Expected Behavior

After submitting the form, the selection should remain the same like for the rest of input controls

Steps To Reproduce

  1. run git clone [email protected]:sikora507/blazor-selectinput-issue.git
  2. run the bazor app
  3. Fill the form in Forms page:
    image
  4. Click submit. The selection will be cleared
    image
  5. Trying submitting the form again with cleared form celection will cause validation error:
    image

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

IDE: JetBrains Rider 2023.3.1

Metadata

Metadata

Assignees

Labels

Pillar: Dev ExperiencePriority:1Work that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions