Skip to content

fix(vue-router): reset tab with memory history - #31511

Merged
ShaneK merged 1 commit into
mainfrom
FW-7756
Oct 1, 2026
Merged

ShaneK merged 1 commit into
mainfrom
FW-7756

Conversation

@ShaneK

@ShaneK ShaneK commented Sep 30, 2026

Copy link
Copy Markdown
Member

Issue number: resolves #29785


What is the current behavior?

Currently, with createMemoryHistory, tapping the active tab from a child page leaves the child on screen. Memory history doesn't store a position in history.state, so the offset resetTab() computes is NaN and router.go(NaN) goes nowhere. On 9.x it also throws Cannot read properties of undefined (reading '0').

What is the new behavior?

When there's no position to traverse, resetTab() now replaces the current entry with the tab's href, the same fallback it already uses after a deep load. It uses the tab's href rather than the first route recorded for the tab, because after a deep load onto a child that first route is the child itself. Web and hash history always have a numeric position, so they're unaffected.

Does this introduce a breaking change?

  • Yes
  • No

Other information

The new tests are in memory.spec.ts, since the Vue test app uses web history and can't reproduce this. They cover resetting from a child page, resetting after a deep load onto a child, and replacing the child entry rather than pushing over it.

@ShaneK
ShaneK requested a review from a team as a code owner September 30, 2026 20:47
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Sep 30, 2026 8:51pm UTC

Request Review

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShaneK
ShaneK added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit edbc304 Oct 1, 2026
69 checks passed
@ShaneK
ShaneK deleted the FW-7756 branch October 1, 2026 15:38

This branch was successfully deployed

1 active deployment
Preview — 06bd3c74 Deployed Sep 30, 2026 by vercel[bot]
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: vue, memoryRouter + tapping tab while inside nested route does nothing

2 participants