fix(bio-links): surface error toasts on analytics fetch, clipboard copy, and SVG QR export failures

Đang mở Phù hợp với người mới
#36 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nextjs, react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu với fetchAnalytics trong apps/web/components/bio-links/BioAnalyticsView.tsx, sau đó kiểm tra handleCopy và handleDownloadSvg trong apps/web/components/bio-links/ShareModal.tsx. Xem các component bio-links gần đó hiển thị lỗi như thế nào và làm theo mẫu toast hiện có. Hoàn thành khi các yêu cầu analytics thất bại, thao tác sao chép vào clipboard và xuất SVG đều hiển thị lỗi mà người dùng có thể nhìn thấy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug good first issue ui web
Problem Description
  1. BioAnalyticsView.tsx (apps/web/components/bio-links/BioAnalyticsView.tsx):
    fetchAnalytics only calls setData(json) inside if (res.ok) and only logs console.error(...) in the catch block. On !res.ok or network failure, no toast.error(...) or visible error state is shown to the user.

  2. ShareModal.tsx (apps/web/components/bio-links/ShareModal.tsx):

    • handleCopy swallows clipboard errors in an empty catch { // fallback } block with no user feedback.
    • handleDownloadSvg only calls console.error('Failed to export SVG QR code:', err) on failure without notifying the user via toast.error(...).

Expected Behavior
  1. BioAnalyticsView.tsx throws on !res.ok and shows a toast.error(...) (and/or an error state) when analytics fail to load.
  2. ShareModal.tsx shows a toast.error(...) when copying the public URL or exporting the SVG QR code fails.

Where to Look
  • apps/web/components/bio-links/BioAnalyticsView.tsx (fetchAnalytics)
  • apps/web/components/bio-links/ShareModal.tsx (handleCopy, handleDownloadSvg)

Solution / Implementation Guide
  1. In BioAnalyticsView.tsx (fetchAnalytics):
    • If !res.ok, throw an error (safely parsing error JSON with .catch(() => ({}))).
    • In catch, call toast.error('Failed to load bio-links analytics') (or set an error state to render a retry message).
  2. In ShareModal.tsx:
    • Import toast (matching the rest of apps/web/components/bio-links/).
    • Call toast.error(...) in the catch blocks of handleCopy and handleDownloadSvg.
Ngôn ngữ chính
TypeScript
Star
2
Fork
1
Merge trung bình
6 phút
Pull request đã merge (30 ngày)
27

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sumamakhan761/tryinstance

Tất cả issue của sumamakhan761/tryinstance

Issue tương tự

Thêm issue về TypeScript

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.