镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(vue-router): keep back working after replacing a page in tabs - #31583

Open
ShaneK wants to merge 1 commit into
mainfrom
FW-7870
Open

ShaneK wants to merge 1 commit into
mainfrom
FW-7870

Conversation

@ShaneK

@ShaneK ShaneK commented Oct 16, 2026

Copy link
Copy Markdown
Member

Issue number: resolves #30617


What is the current behavior?

Currently, replacing a page inside a tab stack breaks going back in two different ways. Calling useIonRouter().replace() shows a back button that does nothing, because replace() sends the root direction, which clears the location history but leaves pushedByRoute set. Calling navigate(path, 'forward', 'replace') after switching tabs does the opposite, so the URL goes back but the replaced page stays on screen. That one happens because the back button calls router.go(-3) and the router assumes the page we left is only one entry ahead.

What is the new behavior?

Now replace() uses the none direction, so it keeps the pages beneath the one it replaced and still doesn't animate, the same as a plain router.replace(). The router also uses the real history delta to find the page we left, and an explicit navigate(url, 'root', 'replace') no longer shows a back button since there's nothing to go back to.

Does this introduce a breaking change?

  • Yes
  • No

Other information

This does change replace() for apps that relied on it clearing the history. That only started in 9.0, when #31142 made the router respect the caller's direction, and those apps can switch to navigate(url, 'root', 'replace'). I updated the useIonRouter docs in ionic-docs to match here: ionic-team/ionic-docs#4794

@ShaneK
ShaneK requested a review from a team as a code owner October 16, 2026 18:27
@ShaneK
ShaneK requested a review from brandyscarney October 16, 2026 18:27
@vercel

vercel Bot commented Oct 16, 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 Oct 16, 2026 6:28pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 861bb1be Deployed Oct 16, 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: navigation breaks when replacing nested tab view

1 participant