all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
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	[thread overview]
Message-ID: <20260515152940.449246-1-s.hanreich@proxmox.com> (raw)

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 <d.csapak@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 .../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





             reply	other threads:[~2026-05-15 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 15:29 Stefan Hanreich [this message]
2026-05-16 18:59 ` applied: [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515152940.449246-1-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal