Fix EditProspectDialog and Prospects: prevent multiple modal openings during save and create operations
This commit is contained in:
@@ -56,13 +56,24 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#region Private Method CreateProspectAsync
|
||||
|
||||
private bool _isOpeningModal;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously creates a new prospect by displaying the AddProspectModal dialog and refreshing the prospect list.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
private async Task CreateProspectAsync()
|
||||
{
|
||||
await EditProspectDialog.ShowAsync(ModalService, LoadProspects);
|
||||
if (_isOpeningModal) return;
|
||||
_isOpeningModal = true;
|
||||
try
|
||||
{
|
||||
await EditProspectDialog.ShowAsync(ModalService, LoadProspects);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isOpeningModal = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user