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 239641FF183 for ; Wed, 10 Sep 2025 13:01:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 85C6D1EB0F; Wed, 10 Sep 2025 13:01:21 +0200 (CEST) Date: Wed, 10 Sep 2025 13:01:17 +0200 From: Wolfgang Bumiller To: Dominik Csapak Message-ID: References: <20250910082649.1007491-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250910082649.1007491-1-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757502052630 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.076 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: Re: [pdm-devel] [PATCH datacenter-manager] ui: main/main menu: fix handling of remote list cache 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 Cc: pdm-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" On Wed, Sep 10, 2025 at 10:26:44AM +0200, Dominik Csapak wrote: > Commit > 0f84394 (ui: main menu: use initial remote list value from context) > tried to handle the initial value of the RemoteList context. > > While this fixed one race (loading of the remote list finished before > the main menu was created) it introduced another race: if the load now > takes longer than the creation, we'll overwrite the PersistentState > (browser local storage) once with an empty list and once with the > correct one. This leads to a refresh not keeping the route since at that > time the route does not exists (since the remotelist is empty) > > To properly fix this, we have to couple the remote list update with the > cache update, as that is the only point in time where we want to do > that. > > For this we have to move the cache update logic to the main entrypoint > (where we update the RemoteList context too) and give the main menu the > list as a a property (from the cache). This way the main menu always has > the view from the cache and this get's updated on every successful api > call to update the remote list. > > We still keep the remotelist context around, since other panels deeper > might need it to query information (e.g. the RemoteSelector) > > Fixes: 0f84394 (ui: main menu: use initial remote list value from context) > Signed-off-by: Dominik Csapak > --- > ui/src/lib.rs | 11 ++++++++- > ui/src/main.rs | 38 +++++++++++++++++++++++------ > ui/src/main_menu.rs | 58 ++++++++++----------------------------------- > 3 files changed, 53 insertions(+), 54 deletions(-) > > diff --git a/ui/src/lib.rs b/ui/src/lib.rs > index 37e6458..3628f41 100644 > --- a/ui/src/lib.rs > +++ b/ui/src/lib.rs > @@ -1,4 +1,7 @@ > -use pdm_api_types::resource::{PveLxcResource, PveQemuResource}; > +use pdm_api_types::{ > + remotes::RemoteType, > + resource::{PveLxcResource, PveQemuResource}, > +}; > use pdm_client::types::Resource; > use serde::{Deserialize, Serialize}; > Just a general note - can we please avoid multi-level braced import lists in general? They make a lot more merge conflicts. *IDEALLY* we'd use import-granularity="Item" style import lists, which, I get, is annoying to do manually, and the option is not sable... but let's not make it even worse? :S _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel