all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-widget-toolkit 2/2] widget: tab panel: improve route handling on creation
Date: Tue, 16 Dec 2025 10:55:19 +0100	[thread overview]
Message-ID: <20251216095529.1019541-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251216095529.1019541-1-d.csapak@proxmox.com>

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@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



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


  reply	other threads:[~2025-12-16  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16  9:55 [yew-devel] [PATCH yew-widget-toolkit 1/2] state: navigation: add 'replace_relative_route' to NavigationContextExt Dominik Csapak
2025-12-16  9:55 ` Dominik Csapak [this message]
2025-12-16 10:35   ` [yew-devel] applied: [PATCH yew-widget-toolkit 2/2] widget: tab panel: improve route handling on creation Dietmar Maurer
2025-12-16 10:35 ` [yew-devel] applied: [PATCH yew-widget-toolkit 1/2] state: navigation: add 'replace_relative_route' to NavigationContextExt Dietmar Maurer

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=20251216095529.1019541-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=yew-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal