ionic-team / ionic-team/ionic-framework
Ionic Framework Lifecycle should wrap with vue ErrorHandler
- 主要语言
- TypeScript
- 星标
- 52.7k
- 派生
- 13.3k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 51
描述
## lifecycle should handle error
I diff the lifecycle hooks code between ionic and vue,
it is better to wrap hooks with `callWithAsyncErrorHandling` as vue do.
## no error handle
vue `onMounted` will hook `onErrorCaptured`, but `onIonViewWillEnter` not
```diff
- onIonViewWillEnter(async () => {
onMounted(async () => {
await init();
});
```
```log
common-class.ts:60 Uncaught (in promise) ApiResultError: Order has expired
at UseApiRouteFetcher.ts:107:15
at callHooks (ofetch.03887fc3.mjs:131:15)
at async $fetchRaw2 (ofetch.03887fc3.mjs:299:7)
at async $fetch2 (ofetch.03887fc3.mjs:316:15)
at async fetchTypedResult (typed-fetcher.ts:78:21)
at async ionicFetchResult (ionic-fetcher.ts:45:12)
at async init (prepay.vue?t=1745726446418:133:32)
at async prepay.vue?t=1745726446418:143:7
```
## ionic lifecycle.ts
https://github.com/ionic-team/ionic-framework/blob/c5c4d1d98973b5114f1e559526d54f5125aeafad/packages/vue/src/hooks/lifecycle.ts#L26-L31
## vue apiLifecycle.ts
https://github.com/vuejs/core/blob/6eb29d345aa73746207f80c89ee8b37ff7b949c9/packages/runtime-core/src/apiLifecycle.ts#L31-L45
```ts
const res = callWithAsyncErrorHandling(hook, target, type, args)
// ....
return res
```
贡献指南
调研方向
Start with packages/vue/src/hooks/lifecycle.ts, especially the lifecycle hook registration around the linked lines, and compare it with Vue's runtime-core/src/apiLifecycle.ts. Verify how async errors from Ionic lifecycle hooks are currently surfaced and use the reported onIonViewWillEnter versus onMounted behavior as the completion check.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100