-
Notifications
You must be signed in to change notification settings - Fork 13.5k
bug: vue, react, ion-back-button does not always select correct route when going back #22830
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
Comments
Will write some tests for this and make PR |
ion-back-button
behavior replaces route in some circumstances when it should actually go back()
ion-back-button
behavior replaces route in some circumstances when it should actually go back()
Thanks for the issue. I took a look at this and the issue seems to be with your usage of Replace the template in <ion-app>
<ion-router-outlet id="main-content"></ion-router-outlet>
</ion-app> Add the following above your <ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
</ion-toolbar>
</ion-header> I tried doing those two things and I was no longer able to reproduce the behavior that was described in this issue (the back button was always visible/active when going back). Using the |
@liamdebeasi well that's fun. |
Yep, I can add some docs for this. |
hey @liamdebeasi Button sequence: Watch the URL bar as you press back. Expected: The router is still calling |
Ah sorry - I was looking at the enabled/disabled back button part of the issue. I can reproduce this - let me take a closer look at this. |
NP. @liamdebeasi
I've found this to be due to this change resolves it at least in this scenario (no idea how it impacts tabbed or nested nav)
|
Ok yeah it looks like the actual navigation behavior is a bug in Ionic Vue. In theory this is also a bug in Ionic React, but I need to test that further. |
ion-back-button
behavior replaces route in some circumstances when it should actually go back()
k. thanks @liamdebeasi let me know if there's anything I can do to help. |
Thanks for the issue. This has been resolved via #22974, and a fix will be available in an upcoming release of Ionic Framework. |
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:
The back button behavior works for most straightforward cases, but depending upon the sequence of the history, sometimes the route gets replaced instead of the
router.back()
getting called.Expected behavior:
router should go back() if an the available history entry is applicable.
Steps to reproduce:
clone and run test application, follow replication steps:
run
ionic serve
localhost:8100
$route.fullPath === history.state.back
. (If you're navigating from page to page and never visiting the same page in a row, then we should expect the current path and the next back path to never be the same)Expected
Actual
Related
Ionic Back Button Issue with explanation: https://github.com/sheamusburns/issue-ionic-router-back-button
Related Form Post: https://forum.ionicframework.com/t/vue-router-history-not-updating-history-state-back-after-ion-back-button-default-click-event/203468
Other information:
N/A
Ionic info:
The text was updated successfully, but these errors were encountered: