dotnet / dotnet/aspnetcore

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

Open
#60,334 3 comments 1 reaction 0 assignees View on GitHub
area-blazor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [x] 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

```razor

Set valid value

@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](https://github.com/user-attachments/assets/3870eeab-aa75-4c81-821d-642287e72411)

### 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.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.