Skip to content

Navigation Lifecycle: document that the lifecycle is triggered also in special case of navigating to the same URL #3265

@mvysny

Description

@mvysny

Tell us about your request

Say that I have a RouterLink which points to the same View as the one currently being shown. The simplest, even though a bit non-sensical, example:

/**
 * The main view contains a button and a click listener.
 */
@Route("")
public class MainView extends VerticalLayout implements AfterNavigationObserver {
    public MainView() {
        add(new RouterLink("Main", MainView.class));
    }

    @Override
    public void afterNavigation(AfterNavigationEvent event) {
        System.out.println("afterNavigation()");
    }
}

When I click on the "Main" link, the "afterNavigation()" gets printed which tells me that the Navigation Lifecycle gets triggered, even though the browser is trying to navigate to the very same URL it's currently on.

Yes it's a bit of a corner-case, but it would be good to explicitly document this kind of the corner-case, that the navigation lifecycle runs even in this very specific corner-case of navigating from MainView to MainView.


If you think this issue is important, add a 👍 reaction to help the community and maintainers prioritize this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    🆕 Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions