You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
In some pages of our Ionic React App we need to go back 2 pages after some action is performed (e.g. button user click). For this we use a go(-2) on the useHistory hook. Current behavior is that the browser address bar shows the correct URL (2 pages back in history), but the page that is shown is the previous page that you would expect from a goBack or go(-1).
Expected behavior:
Expected behavior is that the page that is shown after invoking go(-2) is the page that is 2 pages back in history. Thereby also matching the URL in the browser address bar.
You are forwarded to Dummy Page 2 (path = /dummy2)
Click on the Dummy Page 3 link
You are forwarded to Dummy Page 3 (path = /dummy3)
Click on the button labelled History go(-2)
The URL in the address bar changes into "/dummy1" --> OK
The page that is shown is Dummy Page 2 --> NOK
The sandbox app was created using:
ionic start HistoryDemo blank --type=react
And then just create 3 tsx files each containing a Dummy Page. All Dummy Pages have an IonItem with a routerLink set to the next Dummy Page path. Dummy Page 3 has a IonButton to execute go(-2) using onClick.
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.
Bug Report
Ionic version:
[ ] 4.x
[x] 5.x
Current behavior:
In some pages of our Ionic React App we need to go back 2 pages after some action is performed (e.g. button user click). For this we use a go(-2) on the useHistory hook. Current behavior is that the browser address bar shows the correct URL (2 pages back in history), but the page that is shown is the previous page that you would expect from a goBack or go(-1).
Expected behavior:
Expected behavior is that the page that is shown after invoking go(-2) is the page that is 2 pages back in history. Thereby also matching the URL in the browser address bar.
Steps to reproduce:
See https://codesandbox.io/s/ionic-react-usehistory-go-2-zjsh3 for a simple example application. Steps to reproduce in the sandbox:
The URL in the address bar changes into "/dummy1" --> OK
The page that is shown is Dummy Page 2 --> NOK
The sandbox app was created using:
ionic start HistoryDemo blank --type=react
And then just create 3 tsx files each containing a Dummy Page. All Dummy Pages have an IonItem with a routerLink set to the next Dummy Page path. Dummy Page 3 has a IonButton to execute go(-2) using onClick.
Related code:
See https://codesandbox.io/s/ionic-react-usehistory-go-2-zjsh3 for a simple example application.
Other information:
Ionic info:
Ionic:
Ionic CLI : 6.12.4 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 5.5.4
Capacitor:
Capacitor CLI : 2.4.6
@capacitor/core : 2.4.6
Utility:
cordova-res (update available: 0.15.3) : 0.15.1
native-run (update available: 1.3.0) : 1.0.0
System:
NodeJS : v14.15.3 (/usr/local/Cellar/node@14/14.15.3/bin/node)
npm : 6.14.9
OS : macOS Big Sur
The text was updated successfully, but these errors were encountered: