review(Client.UI): single notification when removing non-retained alarm row

Re-review at 7286d320. -013: AlarmsViewModel.OnAlarmEvent removal path no longer fires a
redundant Replace+Remove (one Remove now), preventing a DataGrid re-paint flash. -012: add
update/remove-path test coverage. + TDD.
This commit is contained in:
Joseph Doherty
2026-06-19 11:58:15 -04:00
parent d68c9db9f9
commit 12efbffd56
3 changed files with 158 additions and 7 deletions
@@ -71,14 +71,21 @@ public partial class AlarmsViewModel : ObservableObject
if (existing != null)
{
var index = AlarmEvents.IndexOf(existing);
AlarmEvents[index] = new AlarmEventViewModel(
e.SourceName, e.ConditionName, e.Severity, e.Message,
e.Retain, e.ActiveState, e.AckedState, e.Time,
e.EventId, e.ConditionNodeId);
// Remove alarms that are no longer retained
if (!e.Retain)
{
// Alarm is no longer retained — remove it with a single collection mutation
// rather than Replace + Remove (which would fire two change notifications).
AlarmEvents.RemoveAt(index);
}
else
{
// Alarm is still retained — update the row in place.
AlarmEvents[index] = new AlarmEventViewModel(
e.SourceName, e.ConditionName, e.Severity, e.Message,
e.Retain, e.ActiveState, e.AckedState, e.Time,
e.EventId, e.ConditionNodeId);
}
}
else if (e.Retain)
{