From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3E4F11FF14C for ; Fri, 15 May 2026 17:30:23 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DE11913043; Fri, 15 May 2026 17:30:20 +0200 (CEST) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome Date: Fri, 15 May 2026 17:29:39 +0200 Message-ID: <20260515152940.449246-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778858979133 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.601 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: AGQ6OLQUDEC5LZ2YYS5ZAYW7SBS4V6N4 X-Message-ID-Hash: AGQ6OLQUDEC5LZ2YYS5ZAYW7SBS4V6N4 X-MailFrom: s.hanreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Rendering the peer list only worked in Firefox, but not chrome-based browsers. This was caused by a race condition when setting the availablePeers and selectedPeers property of the WireGuard PeerSelectionPanel. Rendering the list only worked when the availablePeers were set before the selectedPeers, because the peer list was generated in the setSelectedPeers method, which gets invoked when the selectedPeers config property gets set. If the availablePeers property gets set afterwards, then the selectedPeers method does not generate any entry because availablePeers is empty and the for loop in setSelectedPeers is a no-op. Instead utilize the updateAvailablePeers and updateSelectedPeers hooks, which get executed everytime *after* the respective property has been set. The logic for generating the peer list has been moved into its own function, that gets called from both update methods, ensuring that the peer list gets generated regardless of the order the respective setters are called and when updating any of those two properties. currentNode seems to be set in the child component early enough in both browsers, so the problem doesn't seem to be triggered by that property. Nevertheless, the updatePeerList function requires access to the currentNode - so make sure this is not an issue by calling updatePeerList from updateCurrentNode as well and return early in updatePeerList if currentNode isn't set, since this is a prerequisite for being able to generate a peer list anyway. Reported-by: Dominik Csapak Signed-off-by: Stefan Hanreich --- .../sdn/fabrics/wireguard/InterfacePanel.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js b/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js index 3a9060a02..3fe5588cf 100644 --- a/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js +++ b/www/manager6/sdn/fabrics/wireguard/InterfacePanel.js @@ -81,10 +81,30 @@ Ext.define('PVE.sdn.Fabric.WireGuard.PeerSelectionPanel', { }, ], - setSelectedPeers: function (selectedPeers) { + updateCurrentNode: function() { + let me = this; + me.updatePeerList(); + }, + + updateAvailablePeers: function() { + let me = this; + me.updatePeerList(); + }, + + updateSelectedPeers: function() { + let me = this; + me.updatePeerList(); + }, + + updatePeerList: function () { let me = this; if (!me.isConfiguring) { + let currentNode = me.getCurrentNode(); + if (!currentNode) { + return; + } + let store = me.getStore(); let selectionModel = me.getSelectionModel(); @@ -93,8 +113,11 @@ Ext.define('PVE.sdn.Fabric.WireGuard.PeerSelectionPanel', { selectionModel.select([]); store.removeAll(); - for (const availablePeer of me.getAvailablePeers()) { - if (availablePeer.node === me.getCurrentNode().node_id) { + let availablePeers = me.getAvailablePeers(); + let selectedPeers = me.getSelectedPeers(); + + for (const availablePeer of availablePeers) { + if (availablePeer.node === currentNode.node_id) { continue; } -- 2.47.3