I am writing a data importer that tries to recognize a user and, upon recognition, suggests that the user import their legacy data. All dialogs are run using an injected instance of DialogService.
When recognition is successful, call
bool importData = await DialogService.Confirm("Would you like to import your data?") ?? false;
If the user clicks "Ok", I immediately send a confirmation email, then pop up a new window to wait for the user's code from their email.
Dictionary<string, object> parameters = new Dictionary<string, object>() { { "Email", email } };
DialogOptions options = new DialogOptions()
{
CssClass = "myCustomClass"
};
bool validated = await DialogService.OpenAsync("Email Confirmation", parameters, options);
The problem is that, if the user double-clicks the "Ok" button in the Confirm window, it appears that an additional response is cached and, when OpenAsync is called, it immediately (at least from a human perspective) returns 'true' even though the user hasn't entered their code, or even seen the dialog appear at all.
It may also be worth noting that ConfirmEmail's life cycle methods ARE being run (I can set a break point in OnInitlialized). But the code that I have within ConfirmEmail.razor.cs to perform the Close operation does not get hit. It's being closed by something external to my control, AND it's returning a boolean 'true' value.
Attempting to create a new instance of DialogService results in the ConfirmEmail not being displayed at all. It appears to not have access to the DOM, or something, because it seemingly just hangs. No exception is thrown, or anything. Nothing appears and my code stops. So it looks like it's awaiting the call to OpenAsync indefinitely.
How might I ensure that my second dialog is not prematurely closed?
Edit: It occurred to me that I hadn't updated versions in bit, and I was running 4.15.12. However, even after updating to 4.18.1, the issue remains.