ionic-team / ionic-team/ionic-framework

Ionic Framework Lifecycle should wrap with vue ErrorHandler

Đang mở
#30,374 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
triage
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ả

## 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
```

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.