Skip to content

refactor: 알림 에러 UI 추가 및 FCM 토큰 실패 Sentry 연동 - #332

Merged
kanghaeun merged 4 commits into
devfrom
refactor/304-notification-fcm-error-handling
Jul 15, 2026
Merged

refactor: 알림 에러 UI 추가 및 FCM 토큰 실패 Sentry 연동#332
kanghaeun merged 4 commits into
devfrom
refactor/304-notification-fcm-error-handling

Conversation

@kanghaeun

@kanghaeun kanghaeun commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

작업 요약

  • 알림 목록 로드 실패 시 에러 상태 UI 추가
  • FCM 토큰 등록 실패를 Sentry로 보고

작업 세부 내용

status code 대응 전수조사의 알림/FCM 항목 후속 작업입니다.

알림 목록 로드 실패 시 에러 상태 UI 추가

문제: useGetNotifications로드 실패 시 "새로운 알림이 없어요" 빈 상태로 오표시되어져있었습니다. 이를 빈 상태불러오기 실패로 구분하였습니다.

변경

  • useGetNotifications — 반환값에 isError, refetch 추가
  • NotificationErrorState 신규 — 기존 NotificationEmptyState와 동일한 레이아웃으로 "알림을 불러오지 못했어요" + 다시 시도 버튼(refetch) 제공
  • NotificationContent — 내용 영역을 renderContent()로 분리하고 에러 → 빈 상태 → 목록 순으로 early return 분기

FCM 토큰 등록 실패를 Sentry로 보고

문제: useFcmTokenSyncpostFcmToken 호출은 react-query 밖 직접 호출이라 전역 안전망이 잡지 못하는데, .catch(console.error)로만 처리되어 실서비스에서 토큰 등록이 실패해도 팀이 인지할 수 없었습니다 (푸시 미수신 유저 발생 시 추적 불가).

변경: .catch(console.error) 2곳을 기존 captureError 유틸(tags: { source: 'fcm-token-sync' })로 교체. 백그라운드 동기화이므로 사용자 노출(토스트)은 하지 않고, 앱 재진입/토큰 갱신 시 자연 재시도에 맡김

변경하지 않은 항목

  • 알림 읽음 처리(usePostNotificationsRead) — 낙관적 업데이트가 없는 invalidate 방식이라 롤백할 정합성 문제가 없고, 실패 시 전역 fallback 토스트가 동작하므로 현상 유지
  • SSE — 재연결/백오프/401 재인증 기 구현되어 있어 미변경

연관 이슈

closes #304

Summary by CodeRabbit

  • 새로운 기능
    • 알림 목록 로딩 실패 시 오류 안내 화면과 “다시 시도” 버튼을 제공하여 재시도할 수 있습니다.
    • 무한 스크롤 중 에러가 발생하면 센티넬 대신 “더 불러오지 못함” 메시지와 재시도 버튼을 표시합니다.
  • 버그 수정
    • 알림 로딩 실패 상태가 빈 목록 상태와 명확히 구분되어 표시됩니다.
    • 푸시 토큰 동기화 실패가 오류 추적 시스템에 함께 기록됩니다.

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
depromeet Ready Ready Preview, Comment Jul 15, 2026 1:50am

@github-actions github-actions Bot added the refactor Extra attention is needed label Jul 12, 2026
@github-actions
github-actions Bot requested review from soyeong0115 and ychany July 12, 2026 12:48
@github-actions

Copy link
Copy Markdown

Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47c37f40-80b9-4826-a93a-53af27699dd1

📥 Commits

Reviewing files that changed from the base of the PR and between d8aef0f and 4cad2ab.

📒 Files selected for processing (2)
  • apps/web/src/app/notification/_components/NotificationContent.tsx
  • apps/web/src/app/notification/_hooks/useGetNotifications.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/src/app/notification/_hooks/useGetNotifications.ts
  • apps/web/src/app/notification/_components/NotificationContent.tsx

📝 Walkthrough

Walkthrough

알림 조회 훅이 오류 상태와 재시도 함수를 노출하고, 알림 화면이 초기 조회 오류·페이지 추가 조회 오류·빈 목록·정상 목록을 구분해 렌더링한다. FCM 토큰 등록 실패는 captureErrorfcm-token-sync 태그와 함께 기록된다.

Changes

알림 조회 오류 처리

Layer / File(s) Summary
알림 조회 오류 및 재시도 흐름
apps/web/src/app/notification/_hooks/useGetNotifications.ts, apps/web/src/app/notification/_components/NotificationContent.tsx, apps/web/src/app/notification/_components/NotificationErrorState.tsx
조회 훅이 isError, isFetchNextPageError, refetch를 반환한다. 화면은 초기 조회 오류에서 재시도 화면을, 페이지 추가 조회 오류에서 추가 로드 재시도 버튼을 표시하고 빈 상태와 목록 상태를 구분한다.

FCM 토큰 오류 캡처

Layer / File(s) Summary
FCM 등록 실패 기록
apps/web/src/hooks/useFcmTokenSync.ts
FCM 토큰 등록 실패를 콘솔 출력 대신 source: 'fcm-token-sync' 태그와 함께 captureError로 기록한다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NotificationContent
  participant useGetNotifications
  participant NotificationErrorState
  NotificationContent->>useGetNotifications: 조회 상태와 refetch 수신
  NotificationContent->>NotificationErrorState: 재시도 콜백 전달
  NotificationErrorState->>useGetNotifications: refetch 호출
Loading

Suggested reviewers: soyeong0115, ychany

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning 알림 목록 오류 UI와 FCM 실패 추적은 반영됐지만, 알림 읽음 처리의 낙관적 실패 정합성 요구는 구현되지 않았습니다. 알림 읽음 mutation에 실패 롤백 또는 재조회 로직을 추가해 낙관적 업데이트 정합성을 보장하세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 알림 오류 UI 추가와 FCM 토큰 실패 Sentry 연동이라는 핵심 변경을 잘 요약합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 알림 오류 처리와 FCM 토큰 실패 추적이라는 목적 범위 안에 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/304-notification-fcm-error-handling

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/web/src/app/notification/_components/NotificationErrorState.tsx (1)

8-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

컴포넌트 구조와 스타일링은 가이드라인을 준수합니다.

function 선언 + default export, {ComponentName}Props 네이밍, Tailwind 유틸리티 클래스, 시맨틱 <h1> 사용 모두 기존 NotificationEmptyState 패턴과 일치합니다.

다만 이 오류 상태는 비동기 요청 실패 후 클라이언트에서 조건부로 렌더링되므로, 스크린리더 사용자에게 상태 변경을 알리기 위해 컨테이너에 role="alert" 또는 aria-live="polite"를 추가하는 것을 고려해보세요.

♻️ 제안 개선
-    <div className="flex flex-1 flex-col items-center justify-center gap-[15px] px-6">
+    <div
+      role="alert"
+      className="flex flex-1 flex-col items-center justify-center gap-[15px] px-6"
+    >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/app/notification/_components/NotificationErrorState.tsx` around
lines 8 - 25, Update the root container in NotificationErrorState to expose the
asynchronous error-state change to assistive technologies by adding an
appropriate role="alert" or aria-live="polite" attribute. Preserve the existing
layout, content, and retry behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/app/notification/_hooks/useGetNotifications.ts`:
- Around line 16-17: Update the notification hook’s error handling to
distinguish initial-load failures from pagination failures: use the query’s
initial error state for NotificationErrorState, and handle isFetchNextPageError
separately while preserving the existing notifications and exposing a dedicated
retry for fetchNextPage. Do not use refetch() for pagination retries, since it
reloads the entire query.

---

Nitpick comments:
In `@apps/web/src/app/notification/_components/NotificationErrorState.tsx`:
- Around line 8-25: Update the root container in NotificationErrorState to
expose the asynchronous error-state change to assistive technologies by adding
an appropriate role="alert" or aria-live="polite" attribute. Preserve the
existing layout, content, and retry behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d39c3e2-ee53-4776-9aae-beadc0a3840b

📥 Commits

Reviewing files that changed from the base of the PR and between 719fe2f and d8aef0f.

📒 Files selected for processing (4)
  • apps/web/src/app/notification/_components/NotificationContent.tsx
  • apps/web/src/app/notification/_components/NotificationErrorState.tsx
  • apps/web/src/app/notification/_hooks/useGetNotifications.ts
  • apps/web/src/hooks/useFcmTokenSync.ts

Comment thread apps/web/src/app/notification/_hooks/useGetNotifications.ts
@kanghaeun
kanghaeun merged commit 364d606 into dev Jul 15, 2026
6 checks passed
@kanghaeun
kanghaeun deleted the refactor/304-notification-fcm-error-handling branch July 15, 2026 01:50
iOdiO89 pushed a commit that referenced this pull request Jul 19, 2026
* refactor: 알림 목록 불러오기 실패 시 에러 상태 UI 추가

* refactor: FCM 토큰 등록 실패를 Sentry로 보고

* feat: 알림 페이지네이션 에러 처리 및 재시도 UX 개선
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

알림/FCM 읽음·목록·토큰 실패 대응

1 participant