ionic-team / ionic-team/ionic-framework

bug: ionViewWillEnter triggered incorrectly

未关闭
#29,793 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v7.x

### Current Behavior

ionViewWillEnter is triggered even if no navigation occurs.

If I disable animation on ion-router-oulet and I try to use the swipe gesture on a child page. The ionViewWillEnter event of the parent page will be triggered. Navigation doesn't occur because swipeGesture (due to animation) is disabled is suppose.
`

`

### Expected Behavior

ionViewWillEnter should not be triggered.

### Steps to Reproduce

- Disable animation on ion-router-outlet
- Implement a lifecycle ionViewWillEnter on page 1
- Navigate to page 2
- Make a slide from the left to right (as you want to go back)
- lifecyle ionViewWillEnter will be triggered on page 1 but you remains on page 2

### Code Reproduction URL

https://angular-e2jj3l-qsfpbk.stackblitz.io

### Ionic Info

Ionic:

Ionic CLI : 7.2.0
Ionic Framework : @ionic/angular 7.8.5
@angular-devkit/build-angular : 17.3.3
@angular-devkit/schematics : 17.3.3
@angular/cli : 17.3.3
@ionic/angular-toolkit : 11.0.1

Capacitor:

Capacitor CLI : 6.0.0
@capacitor/android : 6.0.0
@capacitor/core : 6.0.0
@capacitor/ios : 6.0.0

Cordova:

Cordova CLI : 11.1.0
Cordova Platforms : android 12.0.0

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

Android SDK Tools : 26.1.1
ios-sim : 8.0.2
NodeJS : v18.19.1
npm : 10.2.4
OS : macOS Unknown
Xcode : Xcode 15.0 Build version 15A240d

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start with the linked StackBlitz reproduction and the ion-router-outlet configuration using animated="false". Trace the swipe-back attempt from page 2 and observe when page 1 receives ionViewWillEnter. Done means the lifecycle event is not triggered when the gesture does not navigate, while normal navigation still works.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend, mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。