feat: 주최자 알림 토스트를 담기 화면에서만 노출 - #499
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSSE 알림 훅이 ChangesSSE 알림 토스트 범위
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to 알림 토스트 범위 변경은 국소적이며, 현재 병합을 막을 수 있는 실행상 위험은 남아 있지 않습니다. Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/hooks/useNotificationSSE.ts`:
- Around line 176-185: Validate the parsed SSE payload at runtime before
processing it, replacing the unchecked NotificationSsePayloadT assertion with a
Zod schema or type guard that enforces each notification type’s required fields,
including a numeric refId for tournament events. Use only the validated payload
for query invalidation, pathname comparisons, and subsequent event handling, and
ignore or safely reject invalid messages.
🪄 Autofix
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: c2a97862-49d9-48fc-b826-45caa7f566a7
📒 Files selected for processing (1)
apps/web/src/hooks/useNotificationSSE.ts
- 바로가기 제거
d4c9153 to
3cba93e
Compare
작업 요약
작업 세부 내용
SSE 알림 토스트가 타입과 무관하게 어느 페이지에서든 노출되던 것을, 알림 성격에 맞게 범위를 조정했습니다.
1. 주최자가 받는 참여자 활동 알림을 담기 화면 한정으로
TOURNAMENT_JOINED(참여자 입장)TOURNAMENT_ITEM_ADDED(참여자가 후보 담음)TOURNAMENT_ITEM_DELETED(참여자가 후보 뺌)TOURNAMENT_STARTED(주최자가 시작)주최자가 받는 참여자 활동 알림은 담기 화면을 보고 있을 때만 의미가 있습니다. 다른 화면에서는 지금 하는 일과 무관해 방해가 됩니다.
invalidateQueries)는 토스트 노출 여부와 무관하게 항상 실행됩니다. 다른 화면에 있다가 담기 화면으로 돌아와도 목록은 최신입니다.payload.refId를 사용해 해당 토너먼트의 담기 화면인지까지 확인합니다. A 토너먼트를 보는 중에 B 토너먼트 알림이 뜨는 것을 막습니다.TOURNAMENT_STARTED는 놓치면 참여 기회를 잃는 알림이라 별도 case로 분리해 전역 노출을 유지했습니다.2. 토스트의
바로가기버튼 전면 제거담기 화면 한정 알림은 이미 그 페이지에 있는 사용자에게 같은 페이지로 가는 버튼을 주는 셈이라 무의미해졌습니다. 이에 맞춰 전체 토스트에서 제거했습니다.
resolveDeepLink함수 삭제useRouter,QUERY_ACTIONimport 정리router제거 → SSE 재연결 유발 요인이 하나 줄었습니다SCROLL_TO_LAST_QUERY는 이 파일에서 딥링크 URL 조립에만 쓰이던 지역 상수라 함께 삭제했습니다. 원본QUERY_ACTION.VALUE.SCROLL_TO_LAST는 위시 담기 플로우에서 계속 사용하므로 유지됩니다.pathname을 deps 대신 ref 로 참조한 이유pathname을 SSE effect 의 deps 에 넣으면 값은 최신이 되지만, 페이지 이동마다 연결이 끊겼다 재연결됩니다.onopen의 재연결 복구 로직이 매번 실행되어invalidateQueries3개(notifications·tournament·wishlists)가 불필요하게 반복onmessage는 연결 시점에 한 번만 생성되는 클로저라,pathname을 직접 참조하면 연결 당시 값에 고정됩니다(stale closure). 연결은 유지한 채 최신 값만 읽어야 해서 ref 를 경유합니다.스크린샷
변경 전
2026-08-12.6.30.48.mov
변경 후
2026-08-12.6.30.04.mov
연관 이슈
closes #478
Summary by CodeRabbit