Ionic-framework: ion-back-button goes to wrong route for tabs

Created on 26 Jan 2019  ·  11Comments  ·  Source: ionic-team/ionic-framework

Bug Report

Ionic version:


[x] 4.0.0

Current behavior:

How you can see below it goes to wrong tab. I've tried to figure it out with outlet and later with child routes but I failed twice.

screen recording 2019-01-26 at 20 20 07

Expected behavior:

Back button should redirects me to "profile2".

Steps to reproduce:

Related code:

Nothing special:

  • at least two tabs
  • another page in app route

screenshot 2019-01-26 at 20 22 09

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.9.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : none
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, (and 2 other plugins)

System:

   NodeJS : v10.15.0 (/usr/local/bin/node)
   npm    : 6.4.1
   OS     : macOS Mojave
angular bug

Most helpful comment

Hi there,

This issue has been resolved, and I have published a nightly build of Ionic with the fix. You can install it with npm i @ionic/angular@dev.

Please let me know if you are still running into any issues with this.

Thanks!

All 11 comments

This is indeed an issue and needs to be addressed.
At the moment I am working around it by adding/removing a subscription to the tabs change event on ionic view enter/leave, saving the last known tab and navigating to it when the view enters again.

Ionic does try to enforce the selection to the first tab so you see a small flicker while this happens. This can be solved by also attaching a subscription to the tabs change through the view template and if this event fires while the 1st subscription is closed then force selection to the last known tab instead. Jeez....

Same problem here!

I have the same problem. Can we expect a solution in the next release?

I temporarily solved this with specific routerLink on ion-back-button - to force opening needed tab.

duplicate of #15216

Solved by removing default route. Quite weird but it must be connected somehow with outlet maybe. Dunno 🤷‍♂️

Screenshot 2019-03-22 at 13 43 32

Have same problem when using <ion-back-button></ion-back-button>

Solved by removing default route. Quite weird but it must be connected somehow with outlet maybe. Dunno 🤷‍♂️

Screenshot 2019-03-22 at 13 43 32

Thanks it work for me

Hi everyone,

I have opened a PR that should resolve this issue: https://github.com/ionic-team/ionic/pull/18005

One of my colleagues will be reviewing it soon, but in the meantime if anyone would like to take a look and provide feedback, that would be great!

We appreciate your patience as we work to resolve this issue 🙂

Hi there,

This issue has been resolved, and I have published a nightly build of Ionic with the fix. You can install it with npm i @ionic/angular@dev.

Please let me know if you are still running into any issues with this.

Thanks!

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.

Was this page helpful?
0 / 5 - 0 ratings