Skip to content
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: vue, switching tabs back to previously visited tab pushes a new route #24936

Closed
4 of 6 tasks
MimyyK opened this issue Mar 14, 2022 · 5 comments
Closed
4 of 6 tasks
Labels
package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@MimyyK
Copy link

MimyyK commented Mar 14, 2022

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

When I navigate inside the tabs, my navigation history seems to be broken.

It happens when I use the mode="ios" on the <ion-router-outlet> and the swipe back gesture.

I have no errors in the DevTools console.

Expected Behavior

Be able to continue my navigation.

Steps to Reproduce

1 - Click on "level 1" button -> /tabs/tab1/level1
2 - Click on "level 2" button -> /tabs/tab1/level1/level2
3 - Click on "Tab 2" tab button -> /tabs/tab2
3 - Click on "Tab 1" tab button -> /tabs/tab1/level1/level2
4 - Swipe back -> /tabs/tab1/level1
5 - Swipe back -> /tabs/tab1/level1 (it should be /tabs/tab1)
6 - Try to click on "Level 1" button

Video to show the issue:
https://user-images.githubusercontent.com/1482715/158239494-29bf0532-3038-44ae-9300-22dc7d521665.mov

Code Reproduction URL

https://github.com/MimyyK/ionic-tabs-issue

Ionic Info

Ionic:

Ionic CLI : 6.18.2 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 6.0.11

Capacitor:

Capacitor CLI : 3.4.3
@capacitor/android : not installed
@capacitor/core : 3.4.3
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v16.13.0 (/usr/local/bin/node)
npm : 8.5.3
OS : macOS Monterey

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 14, 2022
@liamdebeasi
Copy link
Contributor

Thanks, I can reproduce this behavior.

The problem here is when we switch tabs back to a previously visited tab, we push a new route onto the stack. So in your application we have the following items inside of the Tab 1 stack before tapping Tab 2:

/tabs/tab1
/tabs/tab1/level1
/tabs/tab1/level2

After going to Tab 2 and then tapping Tab 1 again, we now have the following in the Tab 1 stack:

/tabs/tab1
/tabs/tab1/level1
/tabs/tab1/level2
/tabs/tab1/level2

From here, going back updates the /tabs/tab1/level1 route info to record that the "previous route" was /tabs/tab1/level2. Attempting to go back again causes the router to not do anything as there is no /tabs/tab1/level2 route that appears before /tabs/tab1/level1 in the Tab 1 stack.

@liamdebeasi liamdebeasi changed the title bug: vue, broken navigation inside tabs bug: vue, switching tabs back to previously visited tab pushes a new route Mar 14, 2022
@liamdebeasi liamdebeasi added package: vue @ionic/vue package type: bug a confirmed bug report labels Mar 14, 2022
@ionitron-bot ionitron-bot bot removed the triage label Mar 14, 2022
@liamdebeasi
Copy link
Contributor

Part of the fix here is to do the following in https://github.com/ionic-team/ionic-framework/blob/main/packages/vue-router/src/router.ts#L431:

router.go(routeInfo.position - currentHistoryPosition);

Due to #24859, this is causing the ion-back-button to disappear when going back. #24859 should be resolved first.

@liamdebeasi
Copy link
Contributor

Hey there, I wanted to provide a quick update. The underlying issue for this bug is the same as #24303.

I am currently working on a fix for this, but I am going to merge this thread with #24303. Any future updates will be provided on that thread. Thanks!

@MimyyK
Copy link
Author

MimyyK commented Apr 4, 2022

Hi! Thanks for the update ! I will follow this issue ^^

@ionitron-bot
Copy link

ionitron-bot bot commented May 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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants