bug: $ionicHistory creates loop when linking to other tabs
Type: bug
Platform: all
$ionicHistory creates a loop in the following situation:
tab 1 tab.list tab.map tab.location
tab 2 tab.activity
The idea is that I'd like to link from tab 2 to a tab1 state. Let's say I've made an href from the tab.activity view to the tab.location view. When I click that link it loads the view accordingly. Then I use the back button (currently triggers $ionicHistory.goBack()) it goes back to tab.activity. If I then navigate back to tab1 it shows the tab.location view I just linked to. Clicking the back button navigates to tab.activity view again. Thus creating a loop. To me it seems the $ionicHistory is hijacked by the other tab. Thus the tabs don't truly have isolated histories. Am I doing something wrong, because I'm lost for a fix. This seems to be a problem with how $ionicHistory works.
I have this bug too. It is easy to reproduce.
Steps to reproduce:
- Prepare project
1.1. ionic start tabsApp
1.2. cd tabsApp
1.3. ionic platform add android
1.4.
1.5. ionic run android - Navigation 2.1 tap on Account tab 2.2 tap on Chats tab 2.3 tap on first line (Ben Sparrow I guess) 2.4 tap on Account tab again
Then, tapping on back button creates a loop: Ben Sparrow -> Chats -> Account -> Ben Sparrow -> Chats -> Account -> and so on.
Bug reproduced on all android devices.
+1
I also was facing this issue. I commented this part of the code
// if switching to a different history, and the history of the view we're switching
// to has an existing back view from a different history than itself, then
// it's back view would be better represented using the current view as its back view
tmp = getViewById(switchToView.backViewId);
if (tmp && switchToView.historyId !== tmp.historyId) {
hist.stack[hist.cursor].backViewId = currentView.viewId;
}
This stops overwritting the backViewId of an existing view. Not perfect, but at least I am now able to exit the app with hard back button on Android.
+1 Same here, I have something like this Home->Listing->Detail, if using $ionicHistory.goBack() it comes to a looping from Listing->Detail->Listing->Detail not ever coming to Home again. If using back button from browser works correctly.
Hello! Are you all still experiencing this issue?
Hi. I can check this out later. I'm sorry I can't do this right now.
@maxim-dev No problem at all!
@jgw96 the issue is still here. I had checked it with a new app. the bug is reproduced with steps as I mentioned above.
Hi @maxim-dev, we have pushed this change to the master branch. It should be in the next nightly build. Please re-open if you continue to have issues. Thanks for using Ionic - we appreciate it!
Thanks, Dan