-
Notifications
You must be signed in to change notification settings - Fork 0
[Fix/#155] 공유보드 사이드바 정보 수정 #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough로그인 상태를 고려한 사이드바 정보 조회 로직을 개선했습니다. 단일 쿼리에서 두 단계 쿼리로 변경하여, 먼저 myBoardShare를 조회한 후 derived된 shareUri를 이용해 myBoardInfo를 조회합니다. 프로필 이미지, 닉네임, 사운드 개수 표시를 새로운 쿼리 결과로 업데이트했습니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 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 |
|
✨ Storybook: 🔗 https://690458540424857aa71aec97-zzafnjwpcc.chromatic.com/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/components/ui/sidebar.tsx (2)
46-52: 타입 안전성 개선 고려
enabled조건으로myShareUri가 존재할 때만 쿼리가 실행되므로 현재 코드는 안전합니다. 그러나 line 50의as string타입 단언보다는 non-null assertion 연산자(!)를 사용하는 것이 의도를 더 명확하게 표현할 수 있습니다.🔎 제안하는 개선 방안
const { data: myBoardInfo } = useQuery({ queryKey: ["myBoardInfo", myShareUri], - queryFn: () => getBoardInfo(myShareUri as string), + queryFn: () => getBoardInfo(myShareUri!), enabled: isLoggedIn && Boolean(myShareUri), });
40-52: 에러 핸들링 추가 권장현재
myBoardShare와myBoardInfo쿼리에 에러 핸들링이 없습니다. 쿼리 실패 시 사용자에게 적절한 피드백을 제공하기 위해 에러 상태를 처리하는 것을 권장합니다.🔎 제안하는 에러 핸들링 추가
const { data: myBoardShare } = useQuery({ queryKey: ["myBoardShare"], queryFn: getBoardShare, enabled: isLoggedIn, }); const myShareUri = myBoardShare?.data?.shareUri; - const { data: myBoardInfo } = useQuery({ + const { data: myBoardInfo, error: myBoardInfoError } = useQuery({ queryKey: ["myBoardInfo", myShareUri], queryFn: () => getBoardInfo(myShareUri as string), enabled: isLoggedIn && Boolean(myShareUri), });그 후 UI에서 에러 상태를 확인하여 사용자에게 알림을 표시하거나 재시도 옵션을 제공할 수 있습니다.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/ui/sidebar.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/ui/sidebar.tsx (1)
src/apis/board.ts (2)
getBoardShare(32-34)getBoardInfo(56-62)
🔇 Additional comments (4)
src/components/ui/sidebar.tsx (4)
5-5: 변경 사항 확인 완료로그인 사용자의 보드 정보를 가져오기 위해
getBoardShare를 올바르게 import했습니다.
39-44: 쿼리 설정 확인 완료로그인 상태일 때만 사용자의 보드 공유 정보를 가져오도록
enabled조건이 올바르게 설정되었습니다.
193-213: UI 업데이트 확인 완료
myBoardInfo데이터를 사용하도록 올바르게 업데이트되었으며, 옵셔널 체이닝과 적절한 폴백 값을 통해 안전하게 처리되고 있습니다. 이제 타인의 공유보드를 볼 때도 로그인한 사용자의 정보가 표시됩니다.
39-52: 이슈 해결 확인 완료 🎉이번 변경으로 공유보드 사이드바에서 보드 소유자의 정보가 아닌 로그인한 사용자 본인의 정보가 올바르게 표시됩니다. 로그인 상태 체크, 데이터 페칭, UI 렌더링이 모두 적절하게 구현되었습니다.
Also applies to: 193-213
Summary
Tasks
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.