ionic-team / ionic-team/ionic-framework

bug: Angular HMR not working within ion-router-outlet

未关闭
#30,105 2 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
triage
主要语言
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

v8.x

### Current Behavior

Angular hot module replacement does not work inside `ion-router-outlet` but it does work inside `router-outlet` but in that case Ionic life cycle events inherent to `ion-router-outlet` (`ionViewWillEnter`, `ionViewDidEnter`, etc...) are not being fired when hmr occurs (which is normal these event are only part of `ion-router-outlet`).
The same issue has already been reported in Angular repository at [https://github.com/angular/angular/issues/59243](https://github.com/angular/angular/issues/59243) with a link to a code reproduction url at [https://github.com/ReneZeidler/hmr-ionic-bug](https://github.com/ReneZeidler/hmr-ionic-bug), however it is also enough to create a new Ionic project and just make a change within a component inside `ion-router-outlet` to reproduce the issue.

### Expected Behavior

Angular hot module replacement should work inside `ion-router-outlet`.

### Steps to Reproduce

Refer to [https://github.com/angular/angular/issues/59243](https://github.com/angular/angular/issues/59243)

### Code Reproduction URL

https://github.com/ReneZeidler/hmr-ionic-bug

### Ionic Info

Ionic:

Ionic CLI : 7.2.0

Utility:

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

System:

NodeJS : v20.10.0
npm : 10.2.3
OS : Windows 10

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start with the hmr-ionic-bug reproduction and Angular issue #59243, then compare behavior inside ion-router-outlet and router-outlet. Trace the Ionic router outlet integration involved in the reproduction and verify that Angular HMR preserves Ionic lifecycle events; done when component changes hot-reload inside ion-router-outlet while those events still fire.

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

评估

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

把新 issue 发到你的邮箱

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