fix(centralui): dispose ConfigurationAuditLog browser-time module (review 2026-10-21 07/M-1)

This commit is contained in:
Joseph Doherty
2026-10-22 08:36:33 -04:00
parent 0bd856552c
commit bd0f87e523
2 changed files with 74 additions and 0 deletions
@@ -4,6 +4,7 @@
@using ZB.MOM.WW.ScadaBridge.Commons.Entities.Audit
@using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories
@attribute [Authorize(Policy = AuthorizationPolicies.OperationalAudit)]
@implements IAsyncDisposable
@inject ICentralUiRepository CentralUiRepository
@inject NavigationManager Nav
@inject IJSRuntime JS
@@ -286,6 +287,19 @@
private const string BrowserTimeModulePath = "./_content/ZB.MOM.WW.ScadaBridge.CentralUI/js/browser-time.js";
private IJSObjectReference? _browserTimeModule;
/// <summary>
/// Releases the dynamically imported browser-time module so its JS-side object reference
/// is not retained for the life of the circuit. A disconnected circuit has already
/// dropped it, so that failure is expected and swallowed.
/// </summary>
public async ValueTask DisposeAsync()
{
if (_browserTimeModule is null) return;
try { await _browserTimeModule.DisposeAsync(); }
catch (JSDisconnectedException) { /* circuit already gone */ }
_browserTimeModule = null;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender) return;