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: router.go() not working as expected in ionic vue app #28201

Closed
3 tasks done
TaraWei-twobulls opened this issue Sep 20, 2023 · 10 comments · Fixed by #29877
Closed
3 tasks done

bug: router.go() not working as expected in ionic vue app #28201

TaraWei-twobulls opened this issue Sep 20, 2023 · 10 comments · Fixed by #29877
Labels
type: bug a confirmed bug report

Comments

@TaraWei-twobulls
Copy link

TaraWei-twobulls commented Sep 20, 2023

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Actual behaviour: app view is in Page2 but url is Page1's.

Expected Behavior

Expected to be in Page1 for both url and view.

Steps to Reproduce

  1. Home page > Page 1 > Page2 > Page3 using ionRouter.push()
  2. Page3 > Page2 using ionRouter.back()
  3. Trigger history.go(-2) or router.go(-2) in Page2
    4f603fb4-1c47-478f-9229-391b3fcef05c.webm

Code Reproduction URL

https://github.com/TaraWei-twobulls/Ionic-vue-app-router-issue-reproduction/tree/main

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 7.1.2

Capacitor:

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

Additional Information

Seems ionic outlet view does not know where the current view is, and it always go back from the last view in stack though user has been back to the previous view

@ionitron-bot ionitron-bot bot added the triage label Sep 20, 2023
@TaraWei-twobulls TaraWei-twobulls changed the title bug: bug: router.go() not working as expected in ionic vue app Sep 20, 2023
@liamdebeasi liamdebeasi added the ionitron: needs reproduction a code reproduction is needed from the issue author label Sep 20, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 20, 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 Sep 20, 2023
@TaraWei-twobulls
Copy link
Author

Reproduction added. Please find the example codebase and the issue recording.

@averyjohnston averyjohnston added triage and removed ionitron: needs reproduction a code reproduction is needed from the issue author labels Sep 22, 2023
@liamdebeasi
Copy link
Contributor

Did you push the complete code? I see myApp is added as a submodule, but there's no information in there so I can't initialize it.

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Sep 22, 2023
@ionitron-bot ionitron-bot bot removed the triage label Sep 22, 2023
@TaraWei-twobulls
Copy link
Author

TaraWei-twobulls commented Sep 26, 2023

Sorry just noticed that and updated it.
Please run npm i and ionice serve to run locally.

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Sep 26, 2023
@thetaPC thetaPC added the type: bug a confirmed bug report label Nov 17, 2023
@ionitron-bot ionitron-bot bot removed the triage label Nov 17, 2023
@thetaPC
Copy link
Contributor

thetaPC commented Nov 17, 2023

Thank you for reporting the issue. I can confirm that the router.go() is not navigating to the correct view. This issue has been categorized as a bug to prioritize in our backlog.

@bentleyo
Copy link
Contributor

Has there been any update on this one @thetaPC?

We're also running into this problem. It causes navigation to be quite unreliable in some situations and doesn't give us confidence in the ability to navigate backwards in the history stack.

@thetaPC
Copy link
Contributor

thetaPC commented Sep 13, 2024

Thank you for reaching out. I wanted to let you know that the issue is still in our backlog. At the moment, we don’t have a specific timeline for when it will be addressed. However, rest assured that it's on our radar, and we will update this issue as soon as we have more information.

@bentleyo
Copy link
Contributor

@thetaPC I have just submitted a PR for this issue #29877.

It looks like #29846 might be a duplicate of this issue.

github-merge-queue bot pushed a commit that referenced this issue Oct 22, 2024
resolves #28201

This PR fixes the navigation issue related to `router.go` that was
identified in issue #28201. After working on this issue I realised that
@xxllxhdj has already created a PR for this in #29847. While their fix
is great, I have added tests to replicate the issue, reused existing
code and `undefined` will be returned in unexpected situations - which
matches the existing functionality.

## What is the current behavior?

If a user navigates from `/home` -> `/pageA` -> `/pageB` -> `/pageC` ->
back to `/pageB` -> then `router.go(-2)` is called the URL will be
updated to `/home` correctly, but the app will try to render `/pageA`.

This happens for any delta < -1.

## What is the new behavior?

The app will correctly render `/pageA`, which matches the URL.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

---------

Co-authored-by: xxllxhdj <[email protected]>
@thetaPC
Copy link
Contributor

thetaPC commented Oct 22, 2024

Thanks for the issue! This has been resolved via PR #29877 and will be available in an upcoming release of Ionic.

Copy link

ionitron-bot bot commented Nov 21, 2024

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 Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug a confirmed bug report
Projects
None yet
5 participants