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 387CC1FF17E for ; Thu, 27 Nov 2025 16:36:04 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 55ACF7D4E; Thu, 27 Nov 2025 16:36:22 +0100 (CET) From: Shannon Sterz To: pdm-devel@lists.proxmox.com Date: Thu, 27 Nov 2025 16:36:09 +0100 Message-ID: <20251127153609.440415-8-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251127153609.440415-1-s.sterz@proxmox.com> References: <20251127153609.440415-1-s.sterz@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764257737462 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.085 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 6/6] ui: top nav bar: use an abort guard for loading the version 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" so that the request gets aborted when the component is destroyed. this avoids a potential race condition between this request and a potential log in. Signed-off-by: Shannon Sterz --- ui/src/top_nav_bar.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/src/top_nav_bar.rs b/ui/src/top_nav_bar.rs index 7e2af71..aa6d6cb 100644 --- a/ui/src/top_nav_bar.rs +++ b/ui/src/top_nav_bar.rs @@ -7,6 +7,7 @@ use wasm_bindgen::UnwrapThrowExt; use pwt::prelude::*; use pwt::widget::menu::{Menu, MenuButton, MenuEntry, MenuEvent, MenuItem}; +use pwt::AsyncAbortGuard; use yew::html::{IntoEventCallback, IntoPropValue}; use yew::virtual_dom::{VComp, VNode}; @@ -74,6 +75,7 @@ pub struct PdmTopNavBar { dark_mode: bool, version_info: Option, view_state: Option, + abort_guard: Option, } impl Component for PdmTopNavBar { @@ -95,6 +97,7 @@ impl Component for PdmTopNavBar { dark_mode, version_info: None, view_state: None, + abort_guard: None, } } @@ -121,8 +124,10 @@ impl Component for PdmTopNavBar { true } Msg::Load => { - ctx.link() - .send_future(async move { Msg::LoadResult(load_version().await) }); + let link = ctx.link().clone(); + self.abort_guard.replace(AsyncAbortGuard::spawn(async move { + link.send_message(Msg::LoadResult(load_version().await)) + })); true } Msg::LoadResult(result) => { -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel