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

bug: ion-segment (ionChange) trigger is not consistent on start #19204

Closed
chinib opened this issue Aug 27, 2019 · 0 comments · Fixed by #19218

Comments

@chinib
Copy link

commented Aug 27, 2019

Bug Report

Ionic version:

[x] 4.7.1

Current behavior:

ion-segment (ionChange) trigger is not consistent when opening multiple pages containing ion-segment.

Imagine 2 tab pages, named Tab2 and Tab3 for convenience, both with ion-segment. If you open the first one Tab2 the ionChange of the ion-segment is not triggered (as expected), if you afterwards (without restarting the app) open the Tab3 page its ionChange is fired (Unexpected).

This also works vice-versa. Restarting the app and opening first Tab3 will not fire the ionChange of the ion-segment, afterwards opening Tab2 will fire ionChange which is unexpected.

Expected behavior:

One would expect that all pages with ion-segment wouldn't fire its ionChange upon opening. Regardless of which page was opened first.

Steps to reproduce:
Using the simple tabs starter. I've been able to reproduce this problem. By modifying Tab2 and Tab3 to include an ion-segment with (ionChange). Both do a simple console.log output of the event.

  1. Open the app https://ionic-v4-angular-tabs-jrynng.stackblitz.io
  2. Open the console
  3. Click on Tab2 and verify that no ionChange event is shown in console
  4. Click on Tab3 and verify that an ionChange event is shown in console (Unexpected).
  5. Restart app and open console
  6. Click on Tab3 and verify that no ionChange event is shown in console
  7. lick on Tab2 and verify that an ionChange event is show nin console (Unexpected).

Code: https://stackblitz.com/edit/ionic-v4-angular-tabs-jrynng

Additional Info
This bug wasn't present in ionic/angular@4.3.0 My best guess is that something changed to the ion-segment/(ionChange) behavior between version 4.3.0 and 4.7.4

@ionitron-bot ionitron-bot bot added the triage label Aug 27, 2019

@chinib chinib changed the title bug: ion-segment (ionChange) trigger is not consistent bug: ion-segment (ionChange) trigger is not consistent on start Aug 27, 2019

manucorporat added a commit that referenced this issue Aug 28, 2019
manucorporat added a commit that referenced this issue Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.