Ionic-framework: Back button only read first occurrence of router

Created on 18 Jun 2019  路  3Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic version:


[x] 4.x

Current behavior:

In a fresh ionic tabs project, when navigating forward in the app using routerLink.. once the same router is visited, for the second time, the back button will only the see the first occurrence in the navigation stack

Ex: tab1 > page1 > page2>page3>page2
now when the user click the hardware back button or the it will go to page1 instead of page3

Expected behavior:

back button should redirect user to the previous page which is page 3 in the previous example

Steps to reproduce:

  1. create new ionic 4 project with tabs template
  2. create pages: page1, page2, page3
  3. add button in:
  4. tab1 redirecting to page1
  5. page1 redirecting to page2
  6. page2 redirecting to page3
  7. page3 redirecting to page2
  8. run project
  9. now click one all buttons untill you click on the button in page3.
  10. now click on back button (hardware or )
  11. page1 will be shown instead in page3

Related code:
please see:
https://github.com/3adeling/navigation-issue

Other information:

Ionic info:

angular bug

Most helpful comment

Thanks for the follow up! I am able to reproduce this.

At first glance, it looks like the framework is trying to re-use the Page 1 component, including its navigation state.

We will look into this!

All 3 comments

Hi there,

Thanks for the issue! Can you clarify the issue you are seeing?

I am seeing the following behavior:

Start on Tab 1, click button to Page 1
On Page 1, click button to Page 2
On Page 2, click button to Page 3
On Page 3, click button to Page 1
On Page 1, click back button
Redirected to Page 3

This appears to be the correct behavior, so I am interested in finding out how to reproduce the behavior you are reporting.

Thanks!

Are you using chrome back button?! please don't because it works fine.

The issue happens when you use both the ion-back-button (in browser and emulator) OR the device back button

Thanks for the follow up! I am able to reproduce this.

At first glance, it looks like the framework is trying to re-use the Page 1 component, including its navigation state.

We will look into this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fdnhkj picture fdnhkj  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

daveshirman picture daveshirman  路  3Comments