인터페이스 수정#455
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthrough디버그 로그 문을 제거하고, 훅의 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
🧹 Nitpick comments (1)
src/hooks/common/use-group-study-review-reminder.ts (1)
10-12: 훅 입력 타입이 도메인보다 과도하게 넓어졌습니다.
studyType을MemberStudyListRequest['studyType']로 받으면'BOTH' | 'ONE_ON_ONE_STUDY' | undefined까지 허용됩니다. 이 훅은/group-studies/.../reviews/written흐름을 전제로 하므로, 허용값을'GROUP_STUDY' | 'MENTOR_STUDY'로 제한하거나 최소한 런타임 가드로 필터링하는 편이 안전합니다. 지금 타입 계약은 미래 리팩터링 시 잘못된 값 유입을 막지 못합니다.예시 수정안
interface UseGroupStudyReviewReminderOptions { - studyType: MemberStudyListRequest['studyType']; + studyType: 'GROUP_STUDY' | 'MENTOR_STUDY'; }+const SUPPORTED_STUDY_TYPE = { + GROUP_STUDY: true, + MENTOR_STUDY: true, +} as const; + export function useGroupStudyReviewReminder({ studyType, }: UseGroupStudyReviewReminderOptions) { + if (!(studyType in SUPPORTED_STUDY_TYPE)) { + return { + showReviewModal: false, + setShowReviewModal: () => {}, + showCompletionModal: false, + setShowCompletionModal: () => {}, + reviewStudyId: undefined, + reviewDetailInfo: undefined, + reviewBasicInfo: undefined, + }; + }As per coding guidelines
**/*.{tsx,ts}: For enum-like string types from backend, useinoperator guard with fallback instead of simpleastype assertion.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/common/use-group-study-review-reminder.ts` around lines 10 - 12, The hook's input type UseGroupStudyReviewReminderOptions currently accepts MemberStudyListRequest['studyType'] which is too broad; change the contract to only allow the expected values ('GROUP_STUDY' | 'MENTOR_STUDY') or add a runtime guard inside the hook (use-group-study-review-reminder / the function that reads studyType) that uses the in operator against the backend enum shape and filters out/throws on other values so only the '/group-studies/.../reviews/written' flow is processed; do not use simple `as` assertions—validate and narrow the value at runtime and adjust the interface to the narrower union if possible.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/hooks/common/use-group-study-review-reminder.ts`:
- Around line 10-12: The hook's input type UseGroupStudyReviewReminderOptions
currently accepts MemberStudyListRequest['studyType'] which is too broad; change
the contract to only allow the expected values ('GROUP_STUDY' | 'MENTOR_STUDY')
or add a runtime guard inside the hook (use-group-study-review-reminder / the
function that reads studyType) that uses the in operator against the backend
enum shape and filters out/throws on other values so only the
'/group-studies/.../reviews/written' flow is processed; do not use simple `as`
assertions—validate and narrow the value at runtime and adjust the interface to
the narrower union if possible.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 495a7e8d-6b22-41d0-9d5a-5d1e3e5a3bc5
📒 Files selected for processing (2)
src/components/section/my-participating-studies-section.tsxsrc/hooks/common/use-group-study-review-reminder.ts
💤 Files with no reviewable changes (1)
- src/components/section/my-participating-studies-section.tsx
🌱 연관된 이슈
☘️ 작업 내용
🍀 참고사항
스크린샷 (선택)
Summary by CodeRabbit
릴리스 노트
Chores
Refactor