all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome
@ 2026-05-15 15:29 Stefan Hanreich
  2026-05-16 18:59 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2026-05-15 15:29 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome
  2026-05-15 15:29 [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome Stefan Hanreich
@ 2026-05-16 18:59 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-05-16 18:59 UTC (permalink / raw)
  To: pve-devel, Stefan Hanreich

On Fri, 15 May 2026 17:29:39 +0200, Stefan Hanreich wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] sdn: wg interface panel: fix rendering peer list in chrome
      commit: 5cc53243bb5b4c17b1a17e62a60217a75521e142




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-16 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 15:29 [PATCH pve-manager 1/1] sdn: wg interface panel: fix rendering peer list in chrome Stefan Hanreich
2026-05-16 18:59 ` applied: " Thomas Lamprecht

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