There appears to be a cache clearing bug in ionic when you have a view more than 1 level deep, and you hit a tab to bring you back to the first level. The following codepen illustrates it. We setup an alert on page2 to show when the controller gets called.
If you tap Tab2–>Page2, you get an alert. Then if you tap Tab2 again it brings you back to Page1 since you are already on Tab2 (this is good), and tapping Page2 will give you another alert.
Now for the scenario showing the bug:
Tap Tab2–>Page2–>Page3. Now tap Tab2 (it brings you back to Page1 like the previous example). But now if you tap Page2, there is NO alert. Ionic is caching that view when it shouldn’t be.
Of interest is the bug does not occur if you use the history back buttons. It only happens when you are 2+ levels deep in tab, and hit that tab again to bring you to the top level of the tab.
See the Pen Caching Bug.
i mentioned the same thing without tabs.
if you have multiple nested ion-nav-views the “parent”-abstract state gets cached ad not cleaned up correctly in some cases.
The child view is cleared after another “forward” move, but the parent state not.
i think this is the same issue with tabs.
My observation is the behavior of a tab when tapped varies depending on if it is currently selected or not.
If you are on tab2 and navigate to a child view, then click tab1, then tab2, it is going to show the “cached” child view on tab2. This is good and is the expected behavior.
However if you are on tab2, navigate to a child view, then click tab2 (which you are already on), it brings you to the topmost view of that tab. That is also a good thing. But at that point, ionic should clear out the cache of everything on that specific tab, but that isn’t happening. I believe that to be a bug. Or is there a way to programatically clear out the cache of just a particular tab (not the whole application)?
I just discovered another major bug with tab navigation that can be demonstrated with the same codepen as the first post (if anyone can let me know the syntax to embed a codepen in this forum post that would be great).
Here are the steps to show the bug:
1.) Open the Codepen
2.) click Tab2.
3.) click Tab1
4.) click Tab2
5.) click Tab2 again
6.) click Page2. You will see on this step, a page transition starts and then abruptly stops? Then your are stuck in this state – clicking Page2 then does nothing?
It looks like this bug ties in with the first in that they both have one thing in common – tapping a tab that you are already on somehow breaks history/caching in that tab.
Nothing?? Does the Ionic team even monitor these threads?
Since you’ve gotten no replies, I decided to quickly check out your issue. I have been able to reproduce the issue on the codepen you included.
The one workaround that I can suggest off the top of my head would be to completely disable the tab button for the currently selected tab so that no tap/click events get fired at all when tapped again.
I do understand that this is not a real solution to the actual problem but it may serve as a usable workaround in the interim.
Thank you for replying! I just cant believe there has been no response at all from Ionic considering the severity of its affect on user experience and that I have outlined the steps to reproduce both of these related problems so clearly.
The problem with disabling the tab button is that users should be able to touch it again to be taken to the “top level” of the tab if they are currently in a subview of that tab.
Please open an issue on our issue tracker.