EditForm.OnValidSubmit called 4 times in rapid succession
![](https://techprofile.blob.core.windows.net/images/FA0ALqN_QU6SmYMGhVsijw.png?8D97DB)
Hi all;
We have one user this is happening with. We cannot reproduce it and it is not happening to any others. And it has happened to them twice out of 8 uses of the relevant page. Needless to say, I can't create a MVE because we can't reproduce it.
The page (relevant parts) is:
@page "/Account/UserProfile"
@attribute [Authorize]
@inherits ExPageBase
@implements IDisposable
<EditForm EditContext="_editContext" OnValidSubmit="HandleValidSubmitAsync" OnInvalidSubmit="HandleInvalidSubmitAsync" Context="EditFormContext">
<DataAnnotationsValidator />
<CustomValidation @ref="_customValidation" />
<DxFormLayout>
<DxFormLayoutItem ColSpanMd="12">
<DxButton Text="Save Changes to Profile"
Id="save"
SubmitFormOnClick="true"
Enabled="SubmitEnabled"
RenderStyle="@ButtonRenderStyle.Primary" />
</DxFormLayoutItem>
</DxFormLayout>
</EditForm>
private async Task HandleValidSubmitAsync(EditContext editContext)
{
if (LoggerEx.IsEnabled(LogLevel.Debug))
LoggerEx.LogDebug($"User {User.Email} is updating their account.");
And the log shows:
Debug 16:09:12.139 [dw0sdwk00065I]-[user@mail.com] LouisHowe.web.Pages.Account.UserAccountProfile - User user@mail.com is updating their account.
Debug 16:09:12.150 [dw0sdwk00065I]-[user@mail.com] LouisHowe.web.Pages.Account.UserAccountProfile - User user@mail.com is updating their account.
Debug 16:09:12.160 [dw0sdwk00065I]-[user@mail.com] LouisHowe.web.Pages.Account.UserAccountProfile - User user@mail.com is updating their account.
Debug 16:09:14.435 [dw0sdwk00065I]-[user@mail.com] LouisHowe.web.Pages.Account.UserAccountProfile - User user@mail.com is updating their account.
The user says they clicked submit once. We've tried everything we can to reproduce it with no luck.
When this happens it is causing an exception in the EntityFramework save of the data due to duplicates in collections of the user model object. This makes me think somehow the PageModel object is the same for all these calls, and that is then updating the underlying EF model object with the same collection items on each call, thereby placing duplicates in it.
How could the OnValidSubmit
be called repeatedly in quick succession?
thanks - dave