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: Lifecycle hook not firing when going to non tabs page and coming back. #29171

Closed
3 tasks done
Saqib92 opened this issue Mar 18, 2024 · 5 comments
Closed
3 tasks done
Assignees
Labels

Comments

@Saqib92
Copy link

Saqib92 commented Mar 18, 2024

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When going to non tabs page and then coming back Lyfecycle function not firing.

Expected Behavior

it should fire when ever coming to tabs page.

Steps to Reproduce

Check this repo:
#25784

Code Reproduction URL

#25784

Ionic Info

Ionic:

   Ionic CLI                     : 7.2.0 (/Users/fahadaslam/.nvm/versions/node/v20.10.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 7.6.2
   @angular-devkit/build-angular : 17.0.8
   @angular-devkit/schematics    : 17.0.8
   @angular/cli                  : 17.0.8
   @ionic/angular-toolkit        : 9.0.0

Capacitor:

   Capacitor CLI      : 5.6.0
   @capacitor/android : 5.6.0
   @capacitor/core    : 5.6.0
   @capacitor/ios     : 5.6.0

Utility:

   cordova-res                          : not installed globally
   native-run (update available: 2.0.1) : 2.0.0

System:

   NodeJS : v20.10.0 (/Users/fahadaslam/.nvm/versions/node/v20.10.0/bin/node)
   npm    : 10.2.3
   OS     : macOS Unknown

Additional Information

I am using Angular 17, and latest ionic.
This is the exact issue i am facing:
#25784

@ionitron-bot ionitron-bot bot added the triage label Mar 18, 2024
@liamdebeasi liamdebeasi added the ionitron: needs reproduction a code reproduction is needed from the issue author label Mar 18, 2024
Copy link

ionitron-bot bot commented Mar 18, 2024

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@ionitron-bot ionitron-bot bot removed the triage label Mar 18, 2024
@liamdebeasi
Copy link
Contributor

Hi there,

Please attach a new reproduction. The issue you linked to references a previously resolved Vue fix. The Vue and Angular routing implementation are different, so we'll need a new reproduction to verify.

@Saqib92
Copy link
Author

Saqib92 commented Mar 19, 2024

here is the github repo:
https://github.com/Saqib92/ionic7-lifecycle-issue.git

@liamdebeasi
Copy link
Contributor

Thanks for providing a repo. Ionic is working as intended here, though I realize the behavior is a bit confusing. When you go from a tabs page to a non-tabs page, the entire tabs context is considered "leaving". However within the tabs context itself, Tab 1 is still active which is why the lifecycles are not firing on Tab 1 when going to a non-tabs page. You can test this by logging something in the ionViewWillEnter hook on tabs.page.ts. Logging should happen there but not on Tab 1.

As I noted, this is a bit confusing and we are looking to improve this behavior. Ideally ionView* lifecycle events fire on any Ionic page that transitions away regardless of nesting status. We are tracking improvements in #17992.

I posted a workaround in #28078 (comment) that might be of interest to you too.

@liamdebeasi liamdebeasi closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
Copy link

ionitron-bot bot commented Apr 20, 2024

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 Apr 20, 2024
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