[pdm-devel] [PATCH datacenter-manager 3/3] ui: pve tree: prevent from pushing unnecessary route
Dominik Csapak
d.csapak at proxmox.com
Mon Dec 15 16:18:03 CET 2025
In the tree, a route is pushed when the data table selection changes.
When the route changes externally (e.g. the browser back button), we
manually select the correct entry afterwards, which triggers a selection
change, which currently triggers another route push of the same route
that's already active.
This means that on back button click, there will be always a new route
pushed to the same path the user is already on.
Prevent that by comparing the path we want to push with what we're
currently on, and only push it when they differ.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
ui/src/pve/tree.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs
index a496f930..bd60ecc5 100644
--- a/ui/src/pve/tree.rs
+++ b/ui/src/pve/tree.rs
@@ -389,7 +389,14 @@ impl LoadableComponent for PveTreeComp {
if let Some(node) = root.find_node_by_key(&key) {
let record = node.record().clone();
- ctx.link().push_relative_route(&record.get_path());
+ if let Some(nav) = ctx.link().nav_context() {
+ let new_path = record.get_path();
+ let current_path = nav.path();
+ if current_path != new_path {
+ ctx.link().push_relative_route(&new_path);
+ }
+ }
+
ctx.props().on_select.emit(record);
}
}
--
2.47.3
More information about the pdm-devel
mailing list