From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>
Cc: pdm-devel@lists.proxmox.com
Subject: Re: [pdm-devel] [PATCH datacenter-manager] ui: main/main menu: fix handling of remote list cache
Date: Wed, 10 Sep 2025 13:01:17 +0200 [thread overview]
Message-ID: <fxazmhgjk5rq4sq76jz77q3prlhyao4ehi4jfw4wake7scfev6@zd2tmos7gwf4> (raw)
In-Reply-To: <20250910082649.1007491-1-d.csapak@proxmox.com>
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 <d.csapak@proxmox.com>
> ---
> 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
prev parent reply other threads:[~2025-09-10 11:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 8:26 Dominik Csapak
2025-09-10 10:59 ` Wolfgang Bumiller
2025-09-10 11:01 ` Wolfgang Bumiller [this message]
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=fxazmhgjk5rq4sq76jz77q3prlhyao4ehi4jfw4wake7scfev6@zd2tmos7gwf4 \
--to=w.bumiller@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pdm-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox