[pdm-devel] [PATCH datacenter-manager v2 6/6] ui: make the user tab reload when re-opened

Shannon Sterz s.sterz at proxmox.com
Mon Sep 22 17:05:19 CEST 2025


otherwise the view would just be cached when switching between tabs.
this can lead to strange outcomes. for example, when a realm sync job
is run, switching back to the list of users still shows the old state.
by updating the key if the state of the tab changes to `visible` the
component is re-rendered and, thus, the load call in the component is
issued again.

Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
 ui/src/configuration/mod.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ui/src/configuration/mod.rs b/ui/src/configuration/mod.rs
index 6ddc5f2..0a92796 100644
--- a/ui/src/configuration/mod.rs
+++ b/ui/src/configuration/mod.rs
@@ -43,6 +43,7 @@ pub fn system_configuration() -> Html {
 #[function_component(AccessControl)]
 pub fn access_control() -> Html {
     let acl_edit = AclEdit::new(tr!("Path"), PermissionPathSelector::new()).default_role("Auditor");
+    let user_management_revision = use_mut_ref(|| 0usize);
 
     let panel = TabPanel::new()
         .state_id(StorageLocation::session("AccessControlState"))
@@ -55,11 +56,20 @@ pub fn access_control() -> Html {
                 .key("user-management")
                 .icon_class("fa fa-user")
                 .label(tr!("User Management")),
-            |_| {
+            move |s| {
+                if s.visible {
+                    let mut guard = user_management_revision.borrow_mut();
+                    *guard = (*guard).wrapping_add(1);
+                }
                 Container::new()
                     .class("pwt-content-spacer")
                     .class(pwt::css::FlexFit)
                     .with_child(UserPanel::new())
+                    // forces a reload when the tab becomes visible again
+                    .key(format!(
+                        "user-management-{}",
+                        *user_management_revision.borrow()
+                    ))
                     .into()
             },
         )
-- 
2.47.3





More information about the pdm-devel mailing list