Desktop: swap the host lists in whole instead of announcing every row to listeners that redo all their work per row

This commit is contained in:
jaap-jan committed 2026-10-02 15:07:08 +02:00
1 parent a2362d1e3e
commit 7b072bcded
4 files changed
+120 -48

No files matched your search

@@ -669,6 +669,38 @@ public sealed partial class ShellFlowTests : IAsyncLifetime
shell.StatusMessage.ShouldBe("Locked.");
}
/// <remarks>
/// A reload used to empty the host list and refill it a row at a time, announcing each — and the transfers
/// screen refilled its own picker, announcing each of those, on every one of them. Three hundred hosts came
/// to some ninety thousand notifications. Counted here as announcements reaching the two lists, which is
/// what the transfers screen and the board both answer.
/// </remarks>
[Fact]
public async Task ReloadingTheHosts_AnnouncesTheListOnce_NotOncePerHost()
{
await UnlockedAsync();
var vault = shell.Vault!;
foreach (var label in new[] { "prod-db", "prod-web", "stage-web", "dev-box" })
{
await AddHostAsync(vault, label);
}
var vaultAnnouncements = 0;
var pickerAnnouncements = 0;
vault.Hosts.CollectionChanged += (_, _) => vaultAnnouncements++;
shell.Transfers.Hosts.CollectionChanged += (_, _) => pickerAnnouncements++;
await vault.LoadAsync(Token);
vault.Hosts.Count.ShouldBe(4);
shell.Transfers.Hosts.Count.ShouldBe(4);
vaultAnnouncements.ShouldBe(1);
pickerAnnouncements.ShouldBe(1);
}
[Fact]
public async Task AnAutomaticPass_SaysNothingWhenThereIsNothingToDo()
{