-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
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.
- Open the app https://ionic-v4-angular-tabs-jrynng.stackblitz.io
- Open the console
- Click on Tab2 and verify that no ionChange event is shown in console
- Click on Tab3 and verify that an ionChange event is shown in console (Unexpected).
- Restart app and open console
- Click on Tab3 and verify that no ionChange event is shown in console
- 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/[email protected] My best guess is that something changed to the ion-segment/(ionChange) behavior between version 4.3.0 and 4.7.4