Skip to content

bug: NavController.pop not working in nested outlets #28417

Description

@ryaa

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When the user navigates from the main page to a child page with tabs and then clicks on the button which invokes NavController.pop nothing happens. Please note that it works fine with the ionic 7.4.4 and below and the problem seems to existing on the ionic 7.5.x and above.

To reproduce the problem please open https://stackblitz.com/edit/angular-jddxdk-dpaft4
Please note that everything works as expected with the ionic 7.4.4 - see https://stackblitz.com/edit/angular-jddxdk-ybyyrw

Expected Behavior

NavController.pop must navigate back to the home page

Steps to Reproduce

See above

Code Reproduction URL

https://stackblitz.com/edit/angular-jddxdk-dpaft4

Ionic Info

[WARN] Error loading @ionic/angular package.json: Error
       [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package' is not
       defined by "exports" in
       /Users/alexryltsov/Git/BOSS811-MOBILE/chore-680-update-native-and-non-native-dependencies-to-the-latest-versions/node_modules/@ionic/angular/package.json

Ionic:

   Ionic CLI                     : 6.20.8 (/Users/alexryltsov/.nvm/versions/node/v18.12.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : not installed
   @angular-devkit/build-angular : 16.2.7
   @angular-devkit/schematics    : 16.2.7
   @angular/cli                  : 16.2.7
   @ionic/angular-toolkit        : 10.0.0

Capacitor:

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

Utility:

   cordova-res                          : not installed globally
   native-run (update available: 1.7.4) : 1.7.3

System:

   NodeJS : v18.12.0 (/Users/alexryltsov/.nvm/versions/node/v18.12.0/bin/node)
   npm    : 9.6.1
   OS     : macOS Unknown

Additional Information

The problem has been discovered after upgrading to the latest ionic framework 7.5.2. Everything worked fine before the upgrade.
Another notes are:

  • if in the child components with tabs I use ion-back-button instead of the custom button to navigate back, everything works fine even with the latest ionic 7.5.2. See my comment in child.component.html
  • if i use navController.back() instead of navController.pop() everything works fine even with the latest ionic 7.5.2. See my comment in child.component.ts

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