From 8ab520ef570741e5fc269036e35aa139e63a99c3 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 11 Aug 2026 06:06:49 -0400 Subject: [PATCH] fix(scripts): gate the source dialog's existence on the held id, not the resolve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The modal's existence was a function of _rows (FindSourceScript() as the visibility gate), so any render where the row is momentarily unresolvable — a future reload nulling or replacing the list — unmounts the subtree and disposes the Close handler's binding id mid-click (GetRequiredEventBindingEntry). Latent here (_rows is written once, in OnInitializedAsync) but the identical shape bit ScadaBridge live the moment a page refresh landed, and it presents as an unattributable intermittent once one does. ScadaBridge's shape, ported by the family sweep: intent (_sourceScriptId) gates existence, the resolve drives only content; an unresolvable script renders a notice with the frame and Close still mounted, and closing remains the operator's action rather than a side effect of list state. --- .../Components/Pages/Scripts.razor | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Scripts.razor b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Scripts.razor index 54130124..8f3612ac 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Scripts.razor +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Scripts.razor @@ -60,21 +60,42 @@ else } -@if (FindSourceScript() is { } src) +@* The dialog's EXISTENCE is gated on the held id (operator intent); the resolve drives only its + CONTENT. Gating existence on FindSourceScript() would make the modal a function of _rows, and any + render where the row is momentarily unresolvable (a future reload/poll setting _rows null or + replacing the list) would unmount the subtree and dispose the Close handler's binding id — a + click already in flight then throws GetRequiredEventBindingEntry. Latent today (_rows is written + once, in OnInitializedAsync) but the shape bit ScadaBridge live the moment a refresh landed. *@ +@if (_sourceScriptId is not null) { + var src = FindSourceScript();