-
Notifications
You must be signed in to change notification settings - Fork 380
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
fix: Submit action on form inside FluentWizardStep with DeferredLoading fire multiple times #3014
Comments
I have the same issue with Google Chrome. |
I can confirm this issue as well. I did some investigation on this and the main cause for this issue seems to be that the EditForm will always be registered to the See:
So everytime the component will be rendered again another EditForm will be added to the internal list. Each EditForm will then be invoked here:
To fix this we can clear all protected virtual async Task<FluentWizardStepChangeEventArgs> OnStepChangeHandlerAsync(FluentWizardStepChangeEventArgs args)
{
if (_steps[Value].OnChange.HasDelegate)
{
await _steps[Value].OnChange.InvokeAsync(args);
}
if (_steps[Value].DeferredLoading && !args.IsCancelled)
{
_steps[Value].ClearEditFormAndContext();
}
return args;
} this also requires a way to clear the list from the public void ClearEditFormAndContext()
{
_editForms.Clear();
} @dvoituron, @vnbaaij let me know what you think and will proceed to create a PR for this. |
@MarvinKlein1508 yes, that seems like a good solution. Please create/submit a PR for it. Thanks! |
🐛 Bug Report
When a FluentWizardStep with DeferredLoading contains a form with an submit callback (doesn't matter if it is passed to
OnSubmit
,OnValidSubmit
,OnInvalidSubmit
), the callback is fired multiple times, equal to the number of times the step was visited.💻 Repro or Code Sample
GitHub repository here or recreate something that looks like this that makes it easy to see if a submit action is firing multiple times in a row. Then visit the DeferredLoading step multiple times.
🤔 Expected Behavior
If a wizard step contains a form that has a submit callback, the callback should only be called once when going to the next step, whether or not the step has DeferredLoading or not.
😯 Current Behavior
When I revisit a step with DeferredLoading with a submit callback, the callback is called twice (or more if you keep revisiting the step)
🌍 Your Environment
The text was updated successfully, but these errors were encountered: