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

Navigating to the same route is inconsistent #7665

Closed
Artur- opened this issue Feb 25, 2020 · 4 comments
Closed

Navigating to the same route is inconsistent #7665

Artur- opened this issue Feb 25, 2020 · 4 comments
Assignees
Labels
hilla Issues related to Hilla

Comments

@Artur-
Copy link
Member

Artur- commented Feb 25, 2020

Go to start.vaadin.com

  1. Download the default project as "java-only"
  2. Set the "Master detail" view type to "Typescript" and download that project

Start the projects, open http://localhost:9090/dashboard and click on "dashboard" in the menu multiple times.

Expectation:
Regardless of whether the "master detail" view is using Java or Typescript, clicking on "Dashboard" view produces the same result

Actual:
In the Java only application (V14), more and more series are added to the charts when clicking. This is because afterNavigation is called for each click

In the Java+TS application (V15), nothing happens when clicking

@ptdatkhtn ptdatkhtn added the hilla Issues related to Hilla label Feb 25, 2020
@haijian-vaadin
Copy link
Contributor

Let's have an open discussion on this. Haijian will send a calendar invite

@haijian-vaadin haijian-vaadin self-assigned this Feb 25, 2020
@Artur-
Copy link
Member Author

Artur- commented Feb 26, 2020

HTML in general will navigate again to the same page

GitHub catches routing links but also refreshes issues when clicking on "issues" even if you already are on the "issues" page

There are cases where you want the user to be able to refresh by navigating again, such as the GitHub case. Are there cases where you want to avoid navigating even when the link is enabled?

@vlukashov
Copy link

vlukashov commented Apr 24, 2020

There are cases where you want the user to be able to refresh by navigating again, such as the GitHub case. Are there cases where you want to avoid navigating even when the link is enabled?

I do want to avoid trashing and re-creating the DOM content to avoid unnecessary screen flickering. A quick look at several SPAs shows that none of them recreates the views when navigating to the currently active route. In fact, from all SPAs that I have open in my browser(s) at the moment, I cannot find any that does it:

My conclusion here would be that for an SPA re-creating the DOM for the current route is not an expected behavior. I would not want the Router to remove the DOM nodes and re-add them again.

I do want to know that the user has requested the navigation though, because I want to re-fetch the view data and update the view if there are changes. As a developer I expect the Router to trigger some sort of event on each view in the view chain to inform that a navigation event has occurred so that I can trigger a refresh.

@haijian-vaadin
Copy link
Contributor

This should be fixed with vaadin-router 1.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hilla Issues related to Hilla
Projects
None yet
Development

No branches or pull requests

4 participants