[pdm-devel] [PATCH proxmox-yew-comp v2 2/2] apt view: reload if base urls have changed
Lukas Wagner
l.wagner at proxmox.com
Wed Sep 3 13:41:18 CEST 2025
If we use this view to show available node updates, we might want to
change the node afterwards (e.g. by selecting another node in a tree).
By implementing the `changed` function we can trigger a reload if the
relevant props change.
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich at proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
src/apt_package_manager.rs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs
index 6cd179f..3b871f7 100644
--- a/src/apt_package_manager.rs
+++ b/src/apt_package_manager.rs
@@ -256,6 +256,21 @@ impl LoadableComponent for ProxmoxAptPackageManager {
}
}
}
+
+ fn changed(
+ &mut self,
+ ctx: &LoadableComponentContext<Self>,
+ old_props: &Self::Properties,
+ ) -> bool {
+ let props = ctx.props();
+
+ if props.base_url != old_props.base_url || props.task_base_url != old_props.task_base_url {
+ ctx.link().send_reload();
+ true
+ } else {
+ false
+ }
+ }
}
impl From<AptPackageManager> for VNode {
--
2.47.2
More information about the pdm-devel
mailing list