[yew-devel] [PATCH yew-widget-toolkit 2/2] widget: tab panel: improve route handling on creation
Dominik Csapak
d.csapak at proxmox.com
Tue Dec 16 10:55:19 CET 2025
instead of always pushing the route, replace the route, and only if the
selected tab is not the default one.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/widget/tab/tab_bar.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/widget/tab/tab_bar.rs b/src/widget/tab/tab_bar.rs
index d307ca0..d3de24f 100644
--- a/src/widget/tab/tab_bar.rs
+++ b/src/widget/tab/tab_bar.rs
@@ -264,8 +264,10 @@ impl Component for PwtTabBar {
if !(active.is_some() && (path.is_empty() || path == "_")) {
active = get_active_or_default(props, &Some(Key::from(path)));
- } else if let Some(active) = active.as_deref() {
- ctx.link().push_relative_route(active);
+ } else if active != props.get_default_active() {
+ if let Some(active) = active.as_deref() {
+ ctx.link().replace_relative_route(active);
+ }
}
}
}
--
2.47.3
More information about the yew-devel
mailing list