ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

fix(vue): incorrect view rendered when using router.go(-n)

Open bentleyo opened this issue 1 year ago • 4 comments
trafficstars

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

bentleyo avatar Sep 17 '24 09:09 bentleyo

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 Oct 22, 2024 8:18pm

vercel[bot] avatar Sep 17 '24 09:09 vercel[bot]

The main problem was that when using findLastLocation with deltas less than -1, the code no longer checked relative to the specified route. My code change fixes this 😄

bentleyo avatar Sep 17 '24 09:09 bentleyo

@brandyscarney just a heads up, this PR relates to one assigned to you here: https://github.com/ionic-team/ionic-framework/pull/29877

bentleyo avatar Sep 23 '24 07:09 bentleyo

@thetaPC are you able to check this one for me and let me know if any changes required on my end to get this one through? 🙏

bentleyo avatar Oct 09 '24 00:10 bentleyo

Gave @xxllxhdj co author credit as the team decided to go with this approach. Thank you everyone!

thetaPC avatar Oct 22 '24 20:10 thetaPC