refactor(central-ui): contextual errors, parallel recipient load, delete-path test for Notification Lists
This commit is contained in:
@@ -104,14 +104,18 @@
|
||||
{
|
||||
_lists = (await NotificationRepository.GetAllNotificationListsAsync()).ToList();
|
||||
_recipients.Clear();
|
||||
foreach (var list in _lists)
|
||||
var recipientTasks = _lists.ToDictionary(
|
||||
list => list.Id,
|
||||
list => NotificationRepository.GetRecipientsByListIdAsync(list.Id));
|
||||
await Task.WhenAll(recipientTasks.Values);
|
||||
foreach (var (id, task) in recipientTasks)
|
||||
{
|
||||
_recipients[list.Id] = await NotificationRepository.GetRecipientsByListIdAsync(list.Id);
|
||||
_recipients[id] = task.Result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_errorMessage = ex.Message;
|
||||
_errorMessage = $"Failed to load notification lists: {ex.Message}";
|
||||
}
|
||||
_loading = false;
|
||||
}
|
||||
@@ -131,7 +135,7 @@
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_toast.ShowError(ex.Message);
|
||||
_toast.ShowError($"Failed to delete notification list: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user