Skip to content

[BOM-1074] fix: 비로그인 유저의 불필요한 API 호출 방지#293

Open
JeLee-river wants to merge 1 commit into
devfrom
BOM-1074-비로그인-유저의-불필요한-api-호출-방지

Hidden character warning

The head ref may contain hidden characters: "BOM-1074-\ube44\ub85c\uadf8\uc778-\uc720\uc800\uc758-\ubd88\ud544\uc694\ud55c-api-\ud638\ucd9c-\ubc29\uc9c0"
Open

[BOM-1074] fix: 비로그인 유저의 불필요한 API 호출 방지#293
JeLee-river wants to merge 1 commit into
devfrom
BOM-1074-비로그인-유저의-불필요한-api-호출-방지

Conversation

@JeLee-river

Copy link
Copy Markdown
Contributor

📌 What

  • 비로그인 유저가 / 페이지 진입 시 인증이 필요한 API를 불필요하게 호출하던 문제 수정

❓ Why

  • 독서왕 랭킹 컴포넌트(MonthlyRankingContent, StreakRankingContent)는 비로그인 유저도 볼 수 있는 공개 콘텐츠지만, 내 순위 조회(myMonthlyReadingRank, myStreakReadingRank)는 인증 필요
  • 로그인 여부와 무관하게 쿼리가 실행되면서 401 에러가 발생하고 있었음

🔧 How

  • useAuth()isLoggedIn을 조건으로 enabled 옵션 추가
  • useSuspenseQuery(전체 랭킹)는 그대로 유지 — 비로그인 유저도 랭킹 목록은 정상 조회 가능
  • useQuery(내 순위)만 enabled: isLoggedIn으로 가드

👀 Review Point

  • 비로그인 상태에서 / 페이지 진입 시 myMonthlyReadingRank, myStreakReadingRank 요청이 발생하지 않는지 확인
  • 로그인 후 내 순위가 정상적으로 노출되는지 확인
  • 로그아웃 → 로그인 전환 시 isLoggedIn 변경에 따라 쿼리가 재실행되는지 확인

@jaeyoung-kwon jaeyoung-kwon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Review

✅ 확실하게 수정이 필요한 항목을 찾지 못했습니다.

비로그인 사용자에게 인증이 필요한 내 순위 조회(myMonthlyReadingRank, myStreakReadingRank) 쿼리를 enabled: isLoggedIn으로 가드하는 최소 범위 수정입니다. 전체 랭킹(useSuspenseQuery)은 그대로 유지되고, 렌더링부에서도 userRank &&로 undefined를 이미 가드하고 있어 타입/런타임 문제가 없습니다. 로그아웃 시 window.location.reload()로 전체 리로드가 일어나 react-query 캐시가 초기화되므로 로그아웃 후 이전 사용자의 순위 데이터가 잔존해 노출될 위험도 없습니다. isLoggedIn이 false→true로 바뀌면 react-query가 자동으로 refetch하므로 로그인 직후 내 순위도 정상 노출됩니다.

🚨 0 Critical · ⚠️ 0 Major · 📝 0 Minor

📋 검증 과정
  • Claude structured review 결과 중 확신도가 있는 항목만 정리했습니다.
  • Critical/Major는 inline comment로 게시하고, Minor는 참고 항목으로 summary에 포함합니다.
  • 자동 생성된 OpenAPI 타입 선언 파일과 lock 파일은 리뷰 대상에서 제외합니다.

🤖 Claude PR Review


Generated by Claude Code

@sanghee01 sanghee01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

좋은데요? 이제 Sentry 로그인 알림의 악몽 끝나는건가요!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants