fix(adminui): stale-open guards, validation summaries, key-delete confirm, error boundary (#604)

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-08 06:55:23 -04:00
parent 3baa332d6b
commit d3bca7afd4
12 changed files with 504 additions and 13 deletions
@@ -85,20 +85,26 @@
private int _rowCount;
private string? _groupFilter;
// Bumped on every open and close so a superseded build can't install its CSV under another device's modal.
private int _openGeneration;
protected override async Task OnParametersSetAsync()
{
if (Visible && !_built)
{
_built = true;
await BuildAsync();
await BuildAsync(++_openGeneration);
}
else if (!Visible)
{
_built = false;
_openGeneration++;
}
}
private async Task BuildAsync()
private bool IsStale(int generation) => generation != _openGeneration || !Visible;
private async Task BuildAsync(int generation)
{
_loading = true;
_error = null;
@@ -110,6 +116,7 @@
if (!string.IsNullOrEmpty(TagGroupId))
{
var ctx = await ExportReader.ResolveGroupContextAsync(TagGroupId!);
if (IsStale(generation)) { return; }
if (ctx is { } c)
{
_groupFilter = c.GroupPath;
@@ -127,6 +134,7 @@
}
var tags = await ExportReader.ReadDeviceTagsAsync(deviceId);
if (IsStale(generation)) { return; }
// When exporting a single group, keep only that group's subtree (its path + descendants).
if (!string.IsNullOrEmpty(_groupFilter))
@@ -147,11 +155,11 @@
}
catch (Exception ex)
{
_error = ex.Message;
if (!IsStale(generation)) { _error = ex.Message; }
}
finally
{
_loading = false;
if (!IsStale(generation)) { _loading = false; }
}
}
@@ -164,6 +172,7 @@
private async Task Close()
{
_built = false;
_openGeneration++;
_csv = "";
_dataUri = "";
Visible = false;