AppLayout + SideNavItem + HasUrlParameter + Wildcard: click does not call AppLayout::afterNavigation

I have vaadin start application base Vaadin 24.1.11 and Spring Boot. When I click on SideNavItem for the same view with HasUrlParameter + @WildcardParameter(in my case view) but with different parameters, it does not call MainLayout::afterNavigation.

  private SideNav createNavigation() {"createNavigation");
    final SideNav nav = new SideNav();

    nav.addItem(new SideNavItem("Welcome", "welcome")); 

    String test1 = "view/test1/create";
    nav.addItem(new SideNavItem("Test1", test1));

    String test2 = "view/test2/create";
    nav.addItem(new SideNavItem("Test2", test2)); 
    return nav;
  protected void afterNavigation() {"afterNavigation");

  private String getCurrentPageTitle() {
    Component content = getContent();
    PageTitle title = content.getClass().getAnnotation(PageTitle.class);
    if( title != null) {
      return title.value();
    if( content instanceof HasDynamicTitle hasDynamicTitle) {
      return hasDynamicTitle.getPageTitle();
    return "";

@Route(value="view", layout=MainLayout.class)
public class MyView extends VerticalLayout implements HasDynamicTitle, HasUrlParameter<String> {

  private static final Logger log = LoggerFactory.getLogger(MyView.class);
  Text label = new Text("");

  public MyView() {

  public String getPageTitle() {
    return label.getText();

  public void setParameter(BeforeEvent event, @WildcardParameter String parameter) {"setParameter: location={}, parameter={}", event.getLocation().getPathWithQueryParameters(), parameter);

If I click Welcome and after click on Test1, it calls afterNavigation, because it other view.

What is wrong?

The afterNavigation of the Mainlayout should never be used, it’s exposed by accident and probably to be removed. Add the proper navigation Interface to your class go get the correct router lifecircle events

So in another words I should switch on AfterNavigationObserver?


Thank you!

(but I’m not 100% sure if that would solve your issue because you are staying on the same view with different query params… at least it fixes other unforseen problems in the future :sweat_smile:)

I have tried AfterNavigationObserver for MainLayout, it works as expected. Thank you!