Skip to content

MudFormComponent: Clear converter errors on ResetValidation#11971

Merged
ScarletKuro merged 4 commits intoMudBlazor:devfrom
ArfitAP:fix/reset-converter-error-message
Oct 20, 2025
Merged

MudFormComponent: Clear converter errors on ResetValidation#11971
ScarletKuro merged 4 commits intoMudBlazor:devfrom
ArfitAP:fix/reset-converter-error-message

Conversation

@ArfitAP
Copy link
Contributor

@ArfitAP ArfitAP commented Oct 18, 2025

ResetValidation method of MudFormComponent resets the Error, ErrorText and ValidationErrors, but does not clear Converter validation errors. However, HasErrors field checks the conversion errors and therefore its value stays true even after reset.
Conversion errors are now reset as well.

Fixes #11958

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the style of this project.
  • I've added relevant tests or confirmed existing ones.

@mudbot mudbot bot added the bug Unexpected behavior or functionality not working as intended label Oct 18, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue where converter errors were not being cleared by the ResetValidation method in MudFormComponent. The change correctly adds logic to reset the _converter.GetError and _converter.GetErrorMessage properties, ensuring that the component's error state is fully reset. This fixes the bug where HasErrors would remain true after a reset. The implementation is clean, correct, and effectively resolves the issue.

@ScarletKuro
Copy link
Member

Does this fix #11958?
Also, please add an test scenario.

@mudbot mudbot bot changed the title FormComponent: ResetAsync method clears ConverterError messages (#11958) MudFormComponent: Clear converter errors on ResetValidation Oct 19, 2025
@mudbot mudbot bot added the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Oct 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fix ResetValidation so it also clears converter-level errors, ensuring HasErrors reflects the cleared state.

  • Reset _converter.GetError to false within ResetValidation.
  • Reset _converter.GetErrorMessage to null/default within ResetValidation.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ArfitAP
Copy link
Contributor Author

ArfitAP commented Oct 20, 2025

Does this fix #11958? Also, please add an test scenario.

Yes, it fixes #11958.
Test scenario added.

@mudbot mudbot bot removed the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResetAsync not cleare ConverterError

3 participants