Skip to content

Conversation

@xxllxhdj
Copy link
Contributor

@xxllxhdj xxllxhdj commented Sep 7, 2024

Issue number: resolves #28201


What is the current behavior?

Say you have the following application history:

/pageA --> /pageB --> /pageC --> /pageD --> back to /pageC

If you were to call router.go(-2) on /pageC, you would be brought back to /pageB. But the address in the browser address bar is correct.

What is the new behavior?

In above case, if you were to call router.go(-2) on /pageC, you would be brought back to /pageA.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@xxllxhdj xxllxhdj requested a review from a team as a code owner September 7, 2024 20:47
@vercel
Copy link

vercel bot commented Sep 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 7, 2024 8:50pm

@github-actions github-actions bot added the package: vue @ionic/vue package label Sep 7, 2024
@xxllxhdj xxllxhdj changed the title fix(vue): incorrect view rendered when using router.go(-n) #29846 fix(vue): incorrect view rendered when using router.go(-n) Sep 7, 2024
@thetaPC
Copy link
Contributor

thetaPC commented Oct 22, 2024

Thank you for submitting the PR!

This PR will be closed in favor of #29877. You were given co-author credit in the other PR.

@thetaPC thetaPC closed this Oct 22, 2024
github-merge-queue bot pushed a commit that referenced this pull request 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants