Skip to content

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

Closed

Description

@ben-kn-app

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

Activity

  1. changed the title [-]bug: ion-segment (ionChange) trigger is not consistent[/-] [+]bug: ion-segment (ionChange) trigger is not consistent on start[/+] on Aug 27, 2019
  2. added a commit that references this issue on Aug 28, 2019
    387fd40
  3. added a commit that references this issue on Aug 29, 2019
    9751f14
  4. added a commit that references this issue on Aug 30, 2019
    29eb4b1
  5. ionitron-bot commented on Sep 28, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  6. locked and limited conversation to collaborators on Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions