-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: switching between shared tab urls does not preserve individual tab stack history #25213
Comments
Thanks for the issue. Does this dev build help at all? I am fixing a similar issue in #25206.
|
Hey @liamdebeasi still able to follow repro steps and it fails. Happy to try any other dev builds when they're ready 👍 Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-29.at.01.03.02.mp4 |
This comment was marked as off-topic.
This comment was marked as off-topic.
@productdevbook That behavior appears to be unrelated to the issue being discussed in this thread. Please open a separate issue. |
Thanks for testing! The issue appears to be that when going back to Tab 3 for the second time, the browser is wiping the history. The reason for this is when you go back to Tab 2 (you should be on the Tab 2 child page) and press the The big limiting factor here is that the browser history wants linear navigation. Mobile tabs are non-linear by nature as each tab is its individual stack. For example, consider the following flow: /tabs/tab2 --> /tabs/tab2/view --> /tabs/tab3 (tap the Tab 3 button) --> /tabs/tab3/view --> /tabs/tab2/view (tapping the Tab 2 button again). If you press the However, if you press the hardware back button multiple times on an Android device, you should be taken backwards through the following flow: /tabs/tab3/view --> /tabs/tab3 --> /tabs/tab2. Note that going from /tabs/tab3 brings you to /tabs/tab2 not /tabs/tab2/view. The reason for this is we already popped /tabs/tab2/view off the Tab 2 stack. This does not happen due to the issue I noted above. Both the issue you noted and the hardware back button issue stem from how we push new routes when switching between tabs. I have a few ideas for how we can solve this, so I am going to talk with the team and see which option is best. |
The I tested this using the Ionic React Conference App and the Ionic Angular Conference App. |
Hey @liamdebeasi thanks for the explanation, undestood! Pleased we've got it logged as I've had to rework my app to use ion-nav and pushing views onto its own stack but I'd of course prefer to be able to use the router. |
Hey @liamdebeasi do you have an idea of when this issue might get worked on again, it's really preventing me from creating tabbed applications with nested routes. Cheers |
@liamdebeasi Hello, may I know will this be fixed? Thanks. |
We do not provide time estimates of when these issues will be resolved. However, when we do have an update we will post it here. |
Hi, Is this issue still being addressed? If i understand this issue right, for now its impossible to make tabbed apps with the vue-router? |
@philmmoore do you have any information and/or code that you could share regarding the approach you used to get around this issue using ion-nav? Thanks. |
@liamdebeasi until, when and if, this issue gets resolved there should be a warning in the Vue section of the documentation that using tabs with child views is broken. The inability to have child views in tabs severely restricts the ability to use ionic/vue for many types of apps and developers should be aware of this before going down the road, following the documentation and then running into a big roadblock after a lot of time and effort is expended. The documentation (see quote below) should not be showing this approach as an example of how to architect an application when it is not possible. This is obviously not a trivial bug since it has been open for quite some time. At the very least please make developers aware of this so they don't waste a lot of valuable time.
|
I completely agree with you. It definitely must be mentioned in the documentation that child routes in tabs are broken. We have an app that is built on tabs with many child routes in each tab. Hence, ionic vue tabs are broken for use with child routes, we are now unable to continue developing using vue ionic. We have already been developing the app for some time before we stuck on this issue |
Has anyone managed to find a workaround for this issue? |
This comment was marked as off-topic.
This comment was marked as off-topic.
I think I've managed to find a simple workaround. This is what I ended up doing to fix the issue: I just added this to my tabs page, which based on the hardware back button documentation, should stop the default back button behavior and instead do the same thing as clicking on a import type { createIonRouter } from '@ionic/vue-router/dist/types/router.d.ts';
const ionicNavManager = inject('navManager') as ReturnType<typeof createIonRouter>;
useBackButton(1, () => {
if (ionicNavManager === undefined || ionicNavManager === null) {
return;
}
ionicNavManager.handleNavigateBack();
}); @liamdebeasi Do you see any obvious issues with this workaround and is there any reason this isn't the default behavior? |
The issue is not limited to using the hardware back button as it reproduces when tapping tab buttons too which is why we have not implemented that as a solution. We have some design work for this internally to resolve the issue, and I'll definitely follow up here when we have something that is testable. |
Hi! Has this been fixed yet? Creates big problems for us. |
I am having this same issue, but with React. Is this still being working on? |
Same error here! |
@brandyscarney (sorry if you're the wrong person to mention) Seeing as Liam DeBeasi is no longer a part of the Ionic team, could anyone at the Ionic team confirm that this is still being worked on? I don't mean to be impatient or rude, and I'm sorry if I come off that way, it's just that this feels like a pretty fundamental issue that has persisted for over 2 years now. So any update on progress or status would be greatly appreciated. Have a nice day. |
A related behavior, described here happens with |
Related to here as well here as well. Is there any update or any ways around this that are currently known? |
Dear Ionic Team, I hope this message finds you well. I am writing to inquire about the current status of [Issue #25213]regarding the preservation of individual tab stack history when switching between shared tab URLs. This issue has been open since April 2022, and I am interested to know if there have been any developments or plans to address it in upcoming releases. Thank you for your attention to this matter. I look forward to your response |
Prerequisites
Ionic Framework Version
Current Behavior
Within an application we may want to switch from one tab to another to see what information is on the other tab.
If I am on Tab 2 and navigate to a child route /tabs/tab2/view then tap on Tab 3 from the tab bar and again navigate to a child route within Tab 3 /tabs/tab3/view I am able to switch between Tab 1, 2 and 3 and the correct views are displayed
Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-28.at.20.57.19.mp4
If I then navigate to Tab 3 and press back (uses IonBackButton) the view will correctly navigate back.
Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-28.at.20.59.03.mp4
But If I then go to Tab 2 from the tab bar you'll notice that on Tab 2 I no longer have a back button and can no longer get back to the preview view.
Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-28.at.21.00.56.mp4
Tabbing to Tab 1 or 3 does not help. Only tapping the tab on the tab bar quickly does anything but you then have to navigate away and back again.
Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-28.at.21.02.03.mp4
Expected Behavior
I would expect to be able to navigate to child routes within tabs and each nav stack work independently so that I could travel X number of levels deep in Tab 2 then Tab into Tab 3 and again travel X number of levels deep. If I then wanted to get back to the root view for the tab I would either tab the tab bar quickly to 'popToRoot' or use the IonBackButton within each child view to make my way back up.
Steps to Reproduce
Repro steps should be pretty self explanatory based on the videos shown in the current behaviour.
Simulator.Screen.Recording.-.iPhone.12.Pro.-.2022-04-28.at.21.13.06.mp4
Code Reproduction URL
https://github.com/philmmoore/ionic-tabs-bug
Ionic Info
Ionic:
Ionic CLI : 6.18.1 (/Users/philmmoore/.nvm/versions/node/v16.11.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 6.1.3
Capacitor:
Capacitor CLI : 3.5.0
@capacitor/android : not installed
@capacitor/core : 3.5.0
@capacitor/ios : 3.5.0
Utility:
cordova-res (update available: 0.15.4) : 0.15.3
native-run : 1.5.0
System:
NodeJS : v16.11.1 (/Users/philmmoore/.nvm/versions/node/v16.11.1/bin/node)
npm : 8.0.0
OS : macOS Big Sur
Additional Information
No response
The text was updated successfully, but these errors were encountered: