ionic-team / ionic-team/ionic-framework

bug: ion-back-button picks wrong route

Đang mở
#19,030 13 bình luận 4 reaction 0 người được giao Xem trên GitHub
package: core type: bug
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

# Bug Report

**Ionic version:**
[x] **4.x**
[x] **5.x**

**Current behavior:**
I have multiple routes that load the same component with different route props. When clicking the `ion-back-button`, it goes to a different route for the same component, dropping its route props.

**Expected behavior:**
When clicking the `ion-back-button`, it should have the same behavior as using the browser's back button and go back to the url of the previous history entry.

**Steps to reproduce/Related code:**
I created a minimal reproduction of this issue on https://github.com/simonhaenisch/ionic-nav-bug, which has been deployed to [ionic-nav-bug.vercel.app](https://ionic-nav-bug.vercel.app).

The router looks like this:

```tsx




```

To reproduce, do the following:

1. Go to Ionic's profile page (`/profile/ionic`).
2. Go to About page (`/about`).
3. Click the `ion-back-button` (not the browser's back button).

_Expected:_ Goes back to `/profile/ionic` route and shows Ionic's profile.
_Actual:_ It shows Ionic's profile, but the route changes to `/profile` (drops the "name" route prop).

**Other information:**
In this case, using the browser's back button instead works as expected, because unlike `nav.pop` it uses the browser's history stack to go back to the previous url. So I guess a work-around for me would be to implement my own back button that simply calls `window.history.back()`.

Sounds like it could (maybe) be related: #18569.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.