AOSSIE-Org / AOSSIE-Org/PictoPy

BUG: Missing React Error Boundary causes app crashes

Đang mở
#937 6 bình luận 0 reaction 1 người được giao Được @monu808 nhận Xem trên GitHub
enhancement frontend
Ngôn ngữ chính
Python
Star
283
Fork
679
Merge trung bình
7 ngày 2 giờ
Pull request đã merge (30 ngày)
3

Mô tả

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

Hi @rahulharpal1603 ,
While checking out the new steps to run the sync-microservice separately i encountere sometimes the app crahesh bluntly leaving a white screen after it i come to know that the application has no React Error Boundary Component.

How to reproduce:
- Run the command: npm run tauri dev and other backend & sync-microservice command
- trigger any unhandled javascript error(as the error happens rarely so we need to triger manually)
- for ex. add this to Home.tsx
const brokenData = undefined;
return

{brokenData.map(x => x)}
// Crashes!
- The entire app crashes and turns into a blank white screen

Real world scenarios where this could possibly happen:
- Image path is missing
- Networks fails mid-load (most probably happened in my case)

The Solution:
- Create an ErrorBoundary component
- Wrap the main component with the ErrorBoundary in main.tsx
- Display a fallback UI with error details and a “Reload” button

Reference: https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary

### Record

- [x] I agree to follow this project's Code of Conduct

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.