refactor(central-ui): contextual errors, parallel recipient load, delete-path test for Notification Lists

This commit is contained in:
Joseph Doherty
2026-05-19 05:54:48 -04:00
parent 0f90c0ad9c
commit 0fa4ac5525
2 changed files with 45 additions and 7 deletions

View File

@@ -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}");
}
}
}