fix(uns): surface stale-row edits + dismiss modal on delete + @key rows (code-review)
This commit is contained in:
@@ -162,7 +162,7 @@ else
|
||||
<tbody>
|
||||
@foreach (var t in _tags)
|
||||
{
|
||||
<tr>
|
||||
<tr @key="t.TagId">
|
||||
<td>@t.Name</td>
|
||||
<td class="mono">@t.DriverInstanceId</td>
|
||||
<td>@t.DataType</td>
|
||||
@@ -207,7 +207,7 @@ else
|
||||
<tbody>
|
||||
@foreach (var v in _vtags)
|
||||
{
|
||||
<tr>
|
||||
<tr @key="v.VirtualTagId">
|
||||
<td>@v.Name</td>
|
||||
<td>@v.DataType</td>
|
||||
<td class="mono">@v.ScriptId</td>
|
||||
@@ -289,6 +289,7 @@ else
|
||||
|
||||
private async Task OpenAddTag()
|
||||
{
|
||||
_tagError = null;
|
||||
_tagModalIsNew = true;
|
||||
_tagModalExisting = null;
|
||||
_tagDriverOptions = await Svc.LoadTagDriversForEquipmentAsync(EquipmentId!);
|
||||
@@ -297,8 +298,9 @@ else
|
||||
|
||||
private async Task OpenEditTag(string tagId)
|
||||
{
|
||||
_tagError = null;
|
||||
var dto = await Svc.LoadTagAsync(tagId);
|
||||
if (dto is null) { return; }
|
||||
if (dto is null) { _tagError = "That tag no longer exists; the list was refreshed."; await ReloadTagsAsync(); return; }
|
||||
_tagModalIsNew = false;
|
||||
_tagModalExisting = dto;
|
||||
_tagDriverOptions = await Svc.LoadTagDriversForEquipmentAsync(EquipmentId!);
|
||||
@@ -313,6 +315,7 @@ else
|
||||
|
||||
private async Task DeleteTag(string tagId)
|
||||
{
|
||||
_tagModalVisible = false;
|
||||
_tagError = null;
|
||||
// Load the tag fresh to capture its current RowVersion for the optimistic-concurrency delete.
|
||||
var dto = await Svc.LoadTagAsync(tagId);
|
||||
@@ -331,6 +334,7 @@ else
|
||||
|
||||
private async Task OpenAddVirtualTag()
|
||||
{
|
||||
_vtagError = null;
|
||||
_vtagModalIsNew = true;
|
||||
_vtagModalExisting = null;
|
||||
_vtagScriptOptions = await Svc.LoadScriptsAsync();
|
||||
@@ -339,8 +343,9 @@ else
|
||||
|
||||
private async Task OpenEditVirtualTag(string vtagId)
|
||||
{
|
||||
_vtagError = null;
|
||||
var dto = await Svc.LoadVirtualTagAsync(vtagId);
|
||||
if (dto is null) { return; }
|
||||
if (dto is null) { _vtagError = "That virtual tag no longer exists; the list was refreshed."; await ReloadVirtualTagsAsync(); return; }
|
||||
_vtagModalIsNew = false;
|
||||
_vtagModalExisting = dto;
|
||||
_vtagScriptOptions = await Svc.LoadScriptsAsync();
|
||||
@@ -355,6 +360,7 @@ else
|
||||
|
||||
private async Task DeleteVirtualTag(string vtagId)
|
||||
{
|
||||
_vtagModalVisible = false;
|
||||
_vtagError = null;
|
||||
// Load the virtual tag fresh to capture its current RowVersion for the concurrency-guarded delete.
|
||||
var dto = await Svc.LoadVirtualTagAsync(vtagId);
|
||||
|
||||
Reference in New Issue
Block a user