perf(adminui): raw tree renders tag rows from a projection without TagConfig

This commit is contained in:
Joseph Doherty
2026-08-16 04:04:32 -04:00
parent fa36d64e8f
commit ba977dbe0d
2 changed files with 44 additions and 1 deletions
@@ -173,6 +173,7 @@ public sealed class RawTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
var tags = await db.Tags.AsNoTracking()
.Where(t => t.DeviceId == deviceId && t.TagGroupId == null)
.OrderBy(t => t.Name)
.Select(t => new TagRow(t.TagId, t.Name, t.RowVersion))
.ToListAsync(ct);
var nodes = new List<RawNode>(groups.Count + tags.Count);
@@ -194,6 +195,7 @@ public sealed class RawTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
var tags = await db.Tags.AsNoTracking()
.Where(t => t.TagGroupId == groupId)
.OrderBy(t => t.Name)
.Select(t => new TagRow(t.TagId, t.Name, t.RowVersion))
.ToListAsync(ct);
var nodes = new List<RawNode>(subGroups.Count + tags.Count);
@@ -299,7 +301,13 @@ public sealed class RawTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
}).ToList();
}
private static RawNode BuildTagNode(RawNode parent, Tag t) => new()
/// <summary>
/// The only columns a tree row needs from a <see cref="Tag" />. Projecting to this keeps the
/// <c>TagConfig</c> nvarchar(max) JSON blob out of the tree's SELECT — it is never rendered.
/// </summary>
private sealed record TagRow(string TagId, string Name, byte[] RowVersion);
private static RawNode BuildTagNode(RawNode parent, TagRow t) => new()
{
Kind = RawNodeKind.Tag,
Key = $"tag:{t.TagId}",