ionic-team / ionic-team/ionic-framework

bug: Alert button handlers are executed outside the angular zone in certain cases

未关闭
#29,071 3 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
package: angular 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/.github/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

Button handlers of alerts seem to be executed outside the Angular Zone (at least in certain cases).

![ionic_bug_1](https://github.com/ionic-team/ionic-framework/assets/20710097/65ac129a-c767-4d63-9593-234fb444d966)

Strangely enough, when the page is loaded with device emulation, the issue does not seem to appear:

![ionic_bug_2](https://github.com/ionic-team/ionic-framework/assets/20710097/15a76892-fc86-4351-99d2-e0312a2d332d)

This is causing issues when calling angular related functions like trying to start navigation, since these must be called inside the angular zone.

### Expected Behavior

We would always expect a button handler to run inside the Angular Zone.

### Steps to Reproduce

1. Clone provided reproduction repository
2. npm run start
3. Open browser dev tools
4. Make sure device emulation is not enabled
5. Click the button on Tab 1
6. Click the button in the alert
7. Watch the dev console output

### Code Reproduction URL

https://github.com/Airdevelopments/ionic-alert-ngzone

### Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\nvm\v18.16.0\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 7.7.2
@angular-devkit/build-angular : 17.2.0
@angular-devkit/schematics : 17.2.0
@angular/cli : 17.2.0
@ionic/angular-toolkit : 9.0.0

Capacitor:

Capacitor CLI : 5.7.0
@capacitor/android : not installed
@capacitor/core : 5.7.0
@capacitor/ios : not installed

Utility:

cordova-res : 0.15.4
native-run : 2.0.1

System:

NodeJS : v18.16.0 (C:\Program Files\nodejs\node.exe)
npm : 9.8.0
OS : Windows 10

### Additional Information

If you require any addtional information, please let me know.

贡献指南

打开贡献指南

调研方向

Start with the linked reproduction repository and run `npm run start`; reproduce the alert interaction with device emulation disabled and inspect the console output. Trace the Ionic Angular alert button handler path, then verify that the handler runs inside the Angular zone and that Angular navigation works in the reproduction.

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

评估

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

把新 issue 发到你的邮箱

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