diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Dialogs/OpcUaBrowserDialog.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Dialogs/OpcUaBrowserDialog.razor index b1895772..d1556d41 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Dialogs/OpcUaBrowserDialog.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Dialogs/OpcUaBrowserDialog.razor @@ -96,11 +96,18 @@ public bool Truncated { get; set; } } - public async Task ShowAsync() + private string _runtimeSiteId = ""; + private string _runtimeConnectionName = ""; + + public async Task ShowAsync(string siteId, string connectionName, string? initialNodeId) { + // Snapshot at click time. Razor parameter binding propagates on the next + // render, which would race the immediate LoadRootAsync below. + _runtimeSiteId = siteId; + _runtimeConnectionName = connectionName; _isVisible = true; - _manualNodeId = InitialNodeId ?? ""; - _selectedNodeId = InitialNodeId; + _manualNodeId = initialNodeId ?? ""; + _selectedNodeId = initialNodeId; await LoadRootAsync(); } @@ -110,7 +117,7 @@ _rootNodes = new(); StateHasChanged(); - var result = await BrowseService.BrowseChildrenAsync(SiteId, ConnectionName, parentNodeId: null); + var result = await BrowseService.BrowseChildrenAsync(_runtimeSiteId, _runtimeConnectionName, parentNodeId: null); if (result.Failure is not null) { SetFailure(result.Failure); @@ -135,7 +142,7 @@ { node.Loading = true; StateHasChanged(); - var result = await BrowseService.BrowseChildrenAsync(SiteId, ConnectionName, node.NodeId); + var result = await BrowseService.BrowseChildrenAsync(_runtimeSiteId, _runtimeConnectionName, node.NodeId); node.Loading = false; if (result.Failure is not null) diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/InstanceConfigure.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/InstanceConfigure.razor index ddd95f87..3e2c5d8b 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/InstanceConfigure.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Deployment/InstanceConfigure.razor @@ -573,7 +573,7 @@ ?? GetTemplateDefault(attrName); if (_browserRef is not null) - await _browserRef.ShowAsync(); + await _browserRef.ShowAsync(_siteIdentifier, conn.Name, _browserInitial); } private void OnBrowserSelected(string nodeId)