From 721edbbdb127893b5364cfd494a6ea76c2e94966 Mon Sep 17 00:00:00 2001 From: ErikJohnsonLRS Date: Thu, 11 Jul 2024 11:30:21 -0500 Subject: [PATCH] fix: validation stops working when @bind-Value is set on the FluentWizard component to an integer property on the page --- src/Core/Components/Wizard/FluentWizard.razor.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Core/Components/Wizard/FluentWizard.razor.cs b/src/Core/Components/Wizard/FluentWizard.razor.cs index 460f2edcd7..bf5530c0d4 100644 --- a/src/Core/Components/Wizard/FluentWizard.razor.cs +++ b/src/Core/Components/Wizard/FluentWizard.razor.cs @@ -160,6 +160,7 @@ protected virtual async Task OnNextHandlerAsync(MouseEventArgs e) if (!isCanceled) { Value = targetIndex; + await ValueChanged.InvokeAsync(targetIndex); StateHasChanged(); } } @@ -182,6 +183,7 @@ protected virtual async Task OnPreviousHandlerAsync(MouseEventArgs e) if (!isCanceled) { Value = targetIndex; + await ValueChanged.InvokeAsync(targetIndex); StateHasChanged(); } } @@ -190,9 +192,11 @@ protected virtual async Task OnPreviousHandlerAsync(MouseEventArgs e) protected virtual async Task OnStepChangeHandlerAsync(int targetIndex, bool validateEditContexts) { var stepChangeArgs = new FluentWizardStepChangeEventArgs(targetIndex, _steps[targetIndex].Label); + var allEditContextsAreValid = false; + if (validateEditContexts) { - var allEditContextsAreValid = _steps[Value].ValidateEditContexts(); + allEditContextsAreValid = _steps[Value].ValidateEditContexts(); stepChangeArgs.IsCancelled = !allEditContextsAreValid; if (!allEditContextsAreValid) @@ -208,8 +212,6 @@ protected virtual async Task OnStepChangeHandle await _steps[Value].InvokeOnSubmitForEditFormsAsync(); } - await ValueChanged.InvokeAsync(targetIndex); - return await OnStepChangeHandlerAsync(stepChangeArgs); } @@ -256,6 +258,7 @@ internal async Task GoToStepAsync(int targetIndex, bool validateEditContexts) if (!isCanceled) { Value = targetIndex; + await ValueChanged.InvokeAsync(targetIndex); StateHasChanged(); } }