From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D1CFD1FF178 for ; Mon, 15 Dec 2025 16:18:43 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 992B0106F4; Mon, 15 Dec 2025 16:19:29 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Mon, 15 Dec 2025 16:18:03 +0100 Message-ID: <20251215151857.3420519-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251215151857.3420519-1-d.csapak@proxmox.com> References: <20251215151857.3420519-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 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 Subject: [pdm-devel] [PATCH datacenter-manager 3/3] ui: pve tree: prevent from pushing unnecessary route X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" In the tree, a route is pushed when the data table selection changes. When the route changes externally (e.g. the browser back button), we manually select the correct entry afterwards, which triggers a selection change, which currently triggers another route push of the same route that's already active. This means that on back button click, there will be always a new route pushed to the same path the user is already on. Prevent that by comparing the path we want to push with what we're currently on, and only push it when they differ. Signed-off-by: Dominik Csapak --- ui/src/pve/tree.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs index a496f930..bd60ecc5 100644 --- a/ui/src/pve/tree.rs +++ b/ui/src/pve/tree.rs @@ -389,7 +389,14 @@ impl LoadableComponent for PveTreeComp { if let Some(node) = root.find_node_by_key(&key) { let record = node.record().clone(); - ctx.link().push_relative_route(&record.get_path()); + if let Some(nav) = ctx.link().nav_context() { + let new_path = record.get_path(); + let current_path = nav.path(); + if current_path != new_path { + ctx.link().push_relative_route(&new_path); + } + } + ctx.props().on_select.emit(record); } } -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel