Skip to content
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

[Blazor] New parameter value not being reflected when InputBase-derived component displays _incomingValueBeforeParsing (_parsingFailed is true) #60334

Open
1 task done
hakenr opened this issue Feb 12, 2025 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components
Milestone

Comments

@hakenr
Copy link
Member

hakenr commented Feb 12, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When you set new value to Value parameter and the InputBase-derived component is in _parsingFailed == true state, the _parsingFailed is not reset (neither the ValidationMessageStore) and the input renders the previous _incomingValueBeforeParsing.

Expected Behavior

Reset _parsingFailed and _parsingValidationMessages when new Value parameter value is set from outside.

Steps To Reproduce

<InputDate @bind-Value="value" />
<button @onclick="@(() => value = DateTime.Today)">Set valid value</button>

@code {
	private DateTime value;
}
  1. Enter any invalid value to the input, such as 02/30/2000.
  2. Click Set valid value button.
    ...the InputDate does not render current date, the invalid date is still being rendered.

Image

Exceptions (if any)

No response

.NET Version

9.0.1

Anything else?

Introduced within #46434.
(I can try to help with creating an E2E test and implement a PR if we agree on an approach to take.)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Feb 12, 2025
hakenr added a commit to havit/Havit.Blazor that referenced this issue Feb 12, 2025
@javiercn
Copy link
Member

javiercn commented Feb 13, 2025

@hakenr thanks for contacting us.

This seems like a bug. We would accept a PR for this if you are interested in contributing it.

@javiercn javiercn added this to the Backlog milestone Feb 13, 2025
@hakenr
Copy link
Member Author

hakenr commented Feb 13, 2025

@javiercn I'm interested in contributing and would like to discuss one aspect of the implementation.

What's the preferred way to detect when a "new parameter value is coming"? Should I override SetParametersAsync and check if the incoming parameter value differs from Value?

Or would you prefer the change detection and reset to be handled later in the lifecycle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

2 participants