fix(raw): a stale open can no longer feed the picker another device's config

This commit is contained in:
Joseph Doherty
2026-08-05 03:36:04 -04:00
parent c1c21f3ff8
commit 4e3a6e8497
3 changed files with 55 additions and 2 deletions
@@ -170,6 +170,11 @@
}
var dto = await Svc.LoadTagForEditAsync(TagId);
// Two opens can overlap on one modal instance (the tree's Edit command is synchronous and does
// not disable while this resolves), so every post-await write is discarded unless this open is
// still the displayed one. Last-completion-wins would point the picker at another device.
if (_loadedKey != key || !Visible) { return; }
// RawTagEditDto is a record struct → a missing tag comes back as default (all-zero), not null.
if (dto is not { } d || string.IsNullOrEmpty(d.TagId))
{
@@ -192,6 +197,8 @@
try
{
var merged = await Svc.LoadMergedProbeConfigAsync(d.DeviceId);
if (_loadedKey != key || !Visible) { return; } // superseded open → never install its device
if (merged is { } m)
{
_mergedConfigJson = m.MergedConfigJson;