Skip to content

Commit

Permalink
[Input] NotifyFieldChanged is called twice for all FluentInputBase de…
Browse files Browse the repository at this point in the history
…rived components (#1846)
  • Loading branch information
vnbaaij authored Apr 12, 2024
1 parent 1f6ff7d commit b57322f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6288,7 +6288,7 @@
<summary>
Optionally supplies a template for rendering the pagination summary.
The following values can be included:
{your State parameter name}.CurrentPageIndex (zero-basedd, so +1 for the current page number)
{your State parameter name}.CurrentPageIndex (zero-based, so +1 for the current page number)
{your State parameter name}.LastPageIndex (zero-based, so +1 for the total number of pages)
</summary>
</member>
Expand Down
6 changes: 4 additions & 2 deletions src/Core/Components/Base/FluentInputBaseHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ public partial class FluentInputBase<TValue>
/// <returns></returns>
protected virtual async Task ChangeHandlerAsync(ChangeEventArgs e)
{
var isValid = TryParseValueFromString(e.Value?.ToString(), out var result, out var validationErrorMessage);
var _notifyCalled = false;
var isValid = TryParseValueFromString(e.Value?.ToString(), out TValue? result, out var validationErrorMessage);

if (isValid)
{
await SetCurrentValueAsync(result ?? default);
_notifyCalled = true;
}
else
{
Expand All @@ -43,7 +45,7 @@ protected virtual async Task ChangeHandlerAsync(ChangeEventArgs e)
_parsingValidationMessages.Add(FieldIdentifier, validationErrorMessage ?? "Unknown parsing error");
}
}
if (FieldBound)
if (FieldBound && !_notifyCalled)
{
CascadedEditContext?.NotifyFieldChanged(FieldIdentifier);
}
Expand Down

0 comments on commit b57322f

Please sign in to comment.