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, root direction does not unmount wiped views #27191

Open
3 tasks done
maxgaurav opened this issue Apr 13, 2023 · 10 comments
Open
3 tasks done

bug: vue, root direction does not unmount wiped views #27191

maxgaurav opened this issue Apr 13, 2023 · 10 comments
Labels
package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@maxgaurav
Copy link

maxgaurav commented Apr 13, 2023

Prerequisites

Ionic Framework Version

v6.x

Current Behavior

Navigating forward mode with at least 3 forward navigation and then triggering root navigation after the third or more forwarded route does not clean up the mapping of the IonRouterOutlet components completely but only removes 1 Component from the stack and pushes the root element.

Expected Behavior

The expected behavior is that the IonRouterOutlet should reset the stack and start from scratch if the direction is root but it does not you can see the screenshots of stacks created in the Steps to Reproduce.

Steps to Reproduce

Here are step by step for current behavior with VueDev Tool screenshots

The initial state starting at DashboardView

image

Root Navigation to ForumsView

image

Forward Navigation to TopicView

  • The topic view is now a stacked view in the IonRouterOutlet
    image

Another Forward Push to ThreadView

  • Third stacking done
    image

Final Redirection to Dashboard using root as router-direction

  • Side Note: I have also tried replace through vue router ($router), ionRouter instance navigate function using useIonRouter but with no success

image

Code Reproduction URL

https://stackblitz.com/edit/vitejs-vite-yj2kdn?file=src/components/HelloWorld.vue

Ionic Info

Ionic:

   Ionic CLI       : 6.20.4 (/home/maxgaurav/.nvm/versions/node/v18.3.0/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 6.4.1

Capacitor:

   Capacitor CLI      : 4.5.0
   @capacitor/android : 4.5.0
   @capacitor/core    : 4.5.0
   @capacitor/ios     : 4.5.0

Utility:

   cordova-res                          : not installed globally
   native-run (update available: 1.7.2) : 1.6.0

System:

   NodeJS : v18.3.0 (/home/maxgaurav/.nvm/versions/node/v18.3.0/bin/node)
   npm    : 9.1.2
   OS     : Linux 5.15


  ────────────────────────────────────────────────

     Ionic CLI update available: 6.20.4 → 7.0.0
         Run npm i -g @ionic/cli to update

  ────────────────────────────────────────────────

Additional Information

In the IonRouterOutlet component implementation of vue package through debugging i see that action of call unmountLeaving views only being looped once.

I have added the links to the actions below.

const unmountLeavingViews = (

https://github.com/ionic-team/ionic-framework/blob/main/packages/vue/src/components/IonRouterOutlet.ts#L400

@ionitron-bot ionitron-bot bot added the triage label Apr 13, 2023
@liamdebeasi liamdebeasi added the ionitron: needs reproduction a code reproduction is needed from the issue author label Apr 13, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Apr 13, 2023

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@ionitron-bot ionitron-bot bot removed the triage label Apr 13, 2023
@maxgaurav
Copy link
Author

maxgaurav commented Apr 13, 2023

I have added the StackBlitz url for the demo in the description and see below as well. Don't forget to turn on the VueDev tools to see the main problem.

https://stackblitz.com/edit/vitejs-vite-yj2kdn?file=src/components/HelloWorld.vue

@liamdebeasi

@maxgaurav
Copy link
Author

@liamdebeasi

Any update on this? Did the StackBlitz reproduction help?

@amandaejohnston amandaejohnston added triage and removed ionitron: needs reproduction a code reproduction is needed from the issue author labels Apr 17, 2023
@liamdebeasi liamdebeasi changed the title bug: IonRouterOutlet on root navigtation not clearing pushed routes bug: vue, root direction does not unmount wiped views Apr 18, 2023
@liamdebeasi
Copy link
Contributor

Thanks, I can reproduce this. Views 1 and 2 should be unmounted when using routerDirection="root" because the internal stack history is getting wiped.

@liamdebeasi liamdebeasi added package: vue @ionic/vue package type: bug a confirmed bug report labels Apr 18, 2023
@ionitron-bot ionitron-bot bot removed the triage label Apr 18, 2023
@pivko420
Copy link

Any update on this issue? We need this fixed in our app. Only solution right now is to downgrade to older version where it worked so i wont be able to go back from Homepage after login.

@maxgaurav
Copy link
Author

@pivko420
Which version did you downgrade your app to?

I am also waiting for the changes to get fixed but it looks like I may have to end up providing the PR for the fix if there is no activity by next week as this is a significant issue in our app. We have for the time being temporarily closed out the forward navigation flow and made all of them root.

@pivko420
Copy link

I use "@ionic/vue-router": "6.0.0" in another older app and it works there.

package.json
"@capacitor/android": "3.4.3",
"@capacitor/app": "1.0.7",
"@capacitor/core": "3.4.3",
"@capacitor/ios": "3.4.3",
"@capacitor/keyboard": "1.2.0",
"@capacitor/splash-screen": "^1.2.2",
"@ionic/vue": "^6.0.0",
"@ionic/vue-router": "^6.0.0",
"vue": "^3.2.1",
"vue-router": "^4.0.0-0",

@maxgaurav
Copy link
Author

@pivko420
Thanks for sharing. I have tested the same and confirm that it gets fixed in the old version. I am comparing the changes in the old version versus the one I am facing issue and attempting to create a fix. Once done I will generate a PR.

@gzusgo-thinkbig
Copy link

This is still a issue for all. all navigation is boggy. it shows the right url but the view is wrong. is like old view do not die.

@overbost
Copy link

overbost commented Feb 4, 2024

I'm facing same issue with latest @ionic/vue-router 7.7.0.
The components is not unmounted, when the stack grow and we have a lot (4-5) of components mounted the ion-router-outlet break.
Route is matched but the view show the first component loaded in ion-router-outlet

This solve my issue, the ion-router-outlet seem store only the current route but it works
#20597 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

6 participants