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
{{ message }}
Repository navigation
bug: routing breaks after specific sequence of navigations and clicking on ion-back-button #23873
I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v4.x
v5.x
v6.x
Current Behavior
After following a specific order of navigation steps the ion-back-button changes the path but the back animation does not happen and the view stays the same.
Expected Behavior
The ion-back-button should trigger the animation and change the view
Steps to Reproduce
Create a blank ionic vue project and create 3 views.
Add those Views to the router and redirect root to view 2
The views have buttons to go to the next view
View 1 -> View 2 -> View 3
The views also have an ion-back-button.
The App starts on view 2
go to view 3
go back
go back
go to view 2
go to view 3
go back
go back
Now the URL shows the path to view 1 but the last animation did not happen and we are still on view 2
Having the same issue, and it's happening occasionally, including not going back when clicking the ion-back-button and not going forward when calling Vue router's router.replace().
Have to kill the app or reload the url in the browser to make it navigate properly.
I'm using @ionic/vue 5.8.5, vue 3.2.21 and vue-router 4.0.12.
As said this bug (or something very similar) has been a pain for us both in v5.x and in v6 RC 0 through 3.
The most important observation is that this bug is only produced when we are navigating using ion-back-button or using router-link together with router-direction="root".
We have found three workarounds, both of which prevents the bug from happening, but each having their own caveats.
1. Override the default ion-back-button-behavior.
This resolves the ion-back-button from triggering the bug (but does nothing for router-link).
Example:
2. Use MemoryHistory instead of WebHistory
This seems to resolve both bugs with the navigation breaking, but we would really like to keep using WebHistory.
I have the same issue with VueJS, it seems that createMemoryHistory solves it, but then the back button in the browser no longer works, and createWebHashHistory does not seem to fix the bug
As a reference I rewrote my VueJS app to use a single ion-router-outlet, and still this happens. There is sometimes a bug with a missing element (undefined) that Ionic tries to set classList to, and then the router stops working (leavingEl is because leavingViewItem.ionPageElement is undefined)
As a reference I rewrote my VueJS app to use a single ion-router-outlet, and still this happens. There is sometimes a bug with a missing element (undefined) that Ionic tries to set classList to, and then the router stops working (leavingEl is because leavingViewItem.ionPageElement is undefined)
This seems like something I fixed in this pull request: #24433
The tabs using another ion-router-outlet seems funky but I was able to have them play nicely.
I tested this dev build on the app in #23873 (comment) and verified that the issue no longer reproduces. (Though additional testing is always appreciated 😄 )
For some added context, this issue happens when using default-href on ion-back-button to go back to a page that had previously not existed. If you are not using default-href but running into the same behavior as described in this thread, please create a new issue. The issue you are running into is related to a different problem and needs to be triaged separately.
Hi @liamdebeasi
I tried it and it seems that the error is fixed... but in an application that uses sidemenu the error reappears when I click on a menu item and then navigate through the buttons. I don't know if it is related to the same issues
I leave you some examples
@liamdebeasi I have tested this in my app with a side menu as well, I don't get the same error @alons182 has with a side menu. I will do some more testing to see whether it comes back.
What I did in the side menu by the way was replace:
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.
Activity
stevearagonsite commentedon Oct 15, 2021
I have the same issue and try many ways to force update but doesn't execute, the event router end trigger without any error.
tigohenryschultz commentedon Nov 3, 2021
I'm running into the issue, quite a big bug in my opinion. I can't seem to figure out what causes it/reliably reproduce it.
I am on 5.8.5 too
obnijnil commentedon Nov 13, 2021
Having the same issue, and it's happening occasionally, including not going back when clicking the
ion-back-buttonand not going forward when calling Vue router'srouter.replace().Have to kill the app or reload the url in the browser to make it navigate properly.
I'm using @ionic/vue 5.8.5, vue 3.2.21 and vue-router 4.0.12.
scottix commentedon Nov 18, 2021
We are on 5.9.1 and running into an issue that sounds very similar to this, that is getting stuck on a page randomly when navigating in the app.
It is causing a blocker in our deployment, any idea of a fix?
RobinHavre commentedon Nov 25, 2021
We are experiencing the same issue, and for us it's been a pain through all of 5.x and now also on all the RC's for Ionic 6
RobinHavre commentedon Nov 25, 2021
As said this bug (or something very similar) has been a pain for us both in v5.x and in v6 RC 0 through 3.
The most important observation is that this bug is only produced when we are navigating using
ion-back-buttonor usingrouter-linktogether withrouter-direction="root".We have found three workarounds, both of which prevents the bug from happening, but each having their own caveats.
1. Override the default
ion-back-button-behavior.This resolves the
ion-back-buttonfrom triggering the bug (but does nothing forrouter-link).Example:
2. Use MemoryHistory instead of WebHistory
This seems to resolve both bugs with the navigation breaking, but we would really like to keep using WebHistory.
3. Use WebHashHistory instead of WebHistory
This seems to resolve the bugs with
router-link, but does not help with<ion-back-button>These are hacks we are using temporarily, while waiting for the issue to be resolved.
maelp commentedon Dec 24, 2021
I have the same issue with VueJS, it seems that
createMemoryHistorysolves it, but then the back button in the browser no longer works, andcreateWebHashHistorydoes not seem to fix the bugmaelp commentedon Dec 24, 2021
As a reference I rewrote my VueJS app to use a single ion-router-outlet, and still this happens. There is sometimes a bug with a missing element (undefined) that Ionic tries to set
classListto, and then the router stops working (leavingEl is because leavingViewItem.ionPageElement is undefined)tigohenryschultz commentedon Dec 24, 2021
This seems like something I fixed in this pull request: #24433
The tabs using another ion-router-outlet seems funky but I was able to have them play nicely.
maelp commentedon Dec 28, 2021
Seems the bug was for another reason and I fixed it :)
Cannonb4ll commentedon Jan 20, 2022
@maelp
What was the fix you've used?
6 remaining items
liamdebeasi commentedon Jan 27, 2022
Hi there,
Can everyone try the following dev build and let me know if it resolves the issue?
I tested this dev build on the app in #23873 (comment) and verified that the issue no longer reproduces. (Though additional testing is always appreciated 😄 )
For some added context, this issue happens when using
default-hrefonion-back-buttonto go back to a page that had previously not existed. If you are not usingdefault-hrefbut running into the same behavior as described in this thread, please create a new issue. The issue you are running into is related to a different problem and needs to be triaged separately.For anyone interested in why this problem was happening, please see the comment I added in the related PR: https://github.com/ionic-team/ionic-framework/pull/24670/files
migo315 commentedon Jan 27, 2022
Thanks for the fix. I will test it this weekend. :-)
alons182 commentedon Jan 28, 2022
Hi @liamdebeasi
I tried it and it seems that the error is fixed... but in an application that uses sidemenu the error reappears when I click on a menu item and then navigate through the buttons. I don't know if it is related to the same issues
I leave you some examples
from Home Page (menu item)

from List Page (No menu Item)

liamdebeasi commentedon Jan 28, 2022
Do you have a GitHub repo I can take a look at?
alons182 commentedon Jan 28, 2022
Yes... here https://github.com/alons182/sidemenutest
Cannonb4ll commentedon Jan 28, 2022
@liamdebeasi I have tested this in my app with a side menu as well, I don't get the same error @alons182 has with a side menu. I will do some more testing to see whether it comes back.
What I did in the side menu by the way was replace:
With:
liamdebeasi commentedon Jan 31, 2022
Thanks for testing! I resolved those issues and added a new dev build to #23873 (comment).
Mind giving it another test?
Cannonb4ll commentedon Jan 31, 2022
Just did a thoroughly test and it seems completely resolved for me now.
alons182 commentedon Jan 31, 2022
Everything seems to be working fine now
jreviews commentedon Jan 31, 2022
Just tested as well and I am no longer getting the error. Many thanks for your efforts @liamdebeasi
fix(vue): routing history is correctly replaced when overwriting brow…
liamdebeasi commentedon Feb 2, 2022
Thanks for the issue. This has been resolved via #24670, and a fix will be available in an upcoming release of Ionic Framework.
Thank you very much to everyone who helped test and provide feedback! We appreciate your patience as we worked to resolve this issue.
ionitron-bot commentedon Mar 4, 2022
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.