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

Unexpected tab selection change event in beforeEnter #4507

Closed
steffen-harbich-cognitum opened this issue Aug 10, 2018 · 2 comments
Closed

Unexpected tab selection change event in beforeEnter #4507

steffen-harbich-cognitum opened this issue Aug 10, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@steffen-harbich-cognitum

I am trying to make a primary navigation using the Tabs component and routing. Please see my attached example project reproducing the issue. A selection change event is fired unexpectedly although I unregistered the listener before selecting the tab. To reproduce, start the maven goal "spring-boot:run", open the site at localhost:8080 and do:

  • click on tab SubView3 (navigates to /subView3)
  • click on link above tabs, produces logs:

Before enter: SubView1Sub1
Tab selected: SubView1
Before enter: SubView1

Instead of just navigating to the sub sub view 1, additionally it is called a tab selection change event on tab SubView1 which opens that view. But that selection change event is not expected since in MainView#beforeEnter I unregister the event listener before selecting the tab.

Tested with 10.0.2 as well as 11.0.0.beta1, same behavior.

Example project:
my-starter-project.zip

@denis-anisimov
Copy link
Contributor

The reason of this behavior is: selection event is fired from the client side.

That's why you get the event even though you have unregister the listener.
You don't get the event when you set selection from the server side. Because at this time listener is
unregistered.
But then you register it back and a selection event from the client side triggers your listener.

It looks like we get selection events for the "selected" property even if it has the same value. "selected" property is synchronized with the client side and an event is sent from the client side every time when selection is changed even if the value is the same.
This should not happen.

This is definitely a bug and needs to be fixed somehow.

@denis-anisimov
Copy link
Contributor

Issue moved to vaadin/vaadin-tabs-flow #61 via ZenHub

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

No branches or pull requests

2 participants