Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Router blocks navigation to the current view #19635

Closed
knoobie opened this issue Jun 25, 2024 · 4 comments · Fixed by #19730
Closed

React Router blocks navigation to the current view #19635

knoobie opened this issue Jun 25, 2024 · 4 comments · Fixed by #19730

Comments

@knoobie
Copy link
Contributor

knoobie commented Jun 25, 2024

Description of the bug

When I click on a link that targets the current page no server-side round-trip takes place and no navigation events are triggered.

  1. Click prints (when I wanna enter the route for the first time):
Was I called 0?
Was I called 1?
Was I called 2?
  1. Click prints (when I'm already on the route):

Expected behavior

Like in previous versions: The Navigation Observer gets triggered so that I can "reload" the page for people clicking the same link in a menu.

  1. Click prints (when I wanna enter the route for the first time):
Was I called 0?
Was I called 1?
Was I called 2?
  1. Click prints (when I'm already on the route):
Was I called 1?
Was I called 2?

Minimal reproducible example

@Route(value = "test", layout = MainLayout.class) // Your Main Layout of choice where you place a router link to this view
public class TestView extends Div implements BeforeEnterObserver, AfterNavigationObserver {

  public TestView() {
    System.out.println("Was I called 0?");
  }

  @Override
  public void beforeEnter(BeforeEnterEvent event) {
    System.out.println("Was I called 1?");
  }

  @Override
  public void afterNavigation(AfterNavigationEvent afterNavigationEvent) {
    System.out.println("Was I called 2?");
  }
}

Versions

  • Vaadin / Flow version: 24.4.x
@mshabarov
Copy link
Contributor

React Router behaves in a different way than our Vaadin Router in that case.
But nevertheless, this is a bug as the Flow navigation does not happens as it did with Vaadin Router.
We have to investigate, meanwhile the workaround may be to fallback to Vaadin Router unfortunately.

@knoobie
Copy link
Contributor Author

knoobie commented Jul 8, 2024

Created a BFP (VS-5299) for this (just in case Jira has problems)

@mcollovati mcollovati added the BFP Bugfix priority, also known as Warranty label Jul 9, 2024
@mcollovati
Copy link
Collaborator

The issue was triaged and currently added to the backlog priority queue for further investigation

@tepi tepi self-assigned this Jul 19, 2024
@tepi tepi moved this from 🔖 High Priority (P1) to 🏗 WIP in Vaadin Flow bugs & maintenance (Vaadin 10+) Jul 19, 2024
caalador pushed a commit that referenced this issue Jul 31, 2024
Lets navigation cause server round-trip, when navigation is triggered by clicking a link.

Fixes #19635
vaadin-bot pushed a commit that referenced this issue Jul 31, 2024
Lets navigation cause server round-trip, when navigation is triggered by clicking a link.

Fixes #19635
vaadin-bot added a commit that referenced this issue Jul 31, 2024
Lets navigation cause server round-trip, when navigation is triggered by clicking a link.

Fixes #19635

Co-authored-by: Teppo Kurki <[email protected]>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

5 participants