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: ionViewWillLeave not called on specific tab page, when entire TabsPage leaves #18109

Closed
gregor-srdic opened this issue Apr 23, 2019 · 4 comments
Labels

Comments

@gregor-srdic
Copy link

gregor-srdic commented Apr 23, 2019

Bug Report

Ionic version:
[x] 4.x

Current behavior:
I have an empty tabs template project and I've added a settings page outside of tabs.
When I navigate between tabs, lifecycle methods ionViewWillEnter and ionViewWillLeave are called appropriately on each specific tab page (e.g. '/tabs/tab1', '/tabs/tab2', ...).
But when I move to external page (e.g. '/settings') lifecycle methods are not called on the specific tab page, only on the parent TabsPage.

Expected behavior:
Navigating from '/tabs/tab1' to '/settings' would invoke ionViewWillLeave on Tab1Page and navigating back would again invoke ionViewWillEnter on Tab1Page.

Steps to reproduce:
Run the demo app than navigate to settings and back to tabs. Compare console log to the one when switching between tabs.

Related code:

https://github.com/gregor-srdic/ionic4-ionviewwillenter-tabs-bug

[Tab1Page] enter
[TabsPage] enter
[Tab1Page] leave
[Tab2Page] enter
[Tab2Page] leave
[Tab1Page] enter
[TabsPage] leave
                             <-- missing [Tab1Page] leave
[SettingsPage] enter
[SettingsPage] leave
[TabsPage] enter
                             <-- missing [Tab1Page] enter

When entering and leaving settings page, no events are invoked on Tabs1Page (last active specific tab page).

Other information:
This behaviour is very problematic in case of user sign out - I want to redirect user to "/login" when signing out, but then I want to reload user data after logging back in and navigating to tabs.

Ionic info:

Ionic:
   ionic (Ionic CLI)             : 4.12.0 
   Ionic Framework               : @ionic/angular 4.3.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1
System:
   NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10
@ionitron-bot ionitron-bot bot added the triage label Apr 23, 2019
@taipeiwu
Copy link

taipeiwu commented May 4, 2019

Same problem here. Did Ionic team notice this bug? Thanks

@taipeiwu
Copy link

Also related #16834

@liamdebeasi
Copy link
Contributor

Thanks for the issue! I am going to close this as a duplicate of #16834.

There is a fix in the works, and we hope to have it out soon.

Thanks for using Ionic!

@ionitron-bot
Copy link

ionitron-bot bot commented Jun 19, 2019

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jun 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants