-
Notifications
You must be signed in to change notification settings - Fork 3
[fix] ClubIntroContent awards 렌더링 안 되는 문제 해결 #1074
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
- API 응답에서 semesterTerm 필드를 사용하지만 코드에서는 semester 필드만 체크하여 렌더링 실패 - formatSemesterLabel과 getAwardKey에서 semesterTerm과 semester 두 필드명 모두 지원하도록 수정 - null/undefined 안전성을 위해 옵셔널 체이닝 적용 - 모든 테스트 통과 확인
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. Warning
|
| Cohort / File(s) | 요약 |
|---|---|
타입 변경 — Award 인터페이스frontend/src/types/club.ts |
Award 인터페이스에서 semester → semesterTerm: SemesterTermType로 필드명 변경. |
유틸리티 업데이트 — 학기 처리 로직frontend/src/utils/awardHelpers.ts |
내부 구현을 award.semesterTerm 기반으로 변경 (formatSemesterLabel, getAwardKey 등). 공개 시그니처는 불변. |
테스트 업데이트frontend/src/utils/awardHelpers.test.ts |
테스트 데이터와 assertions에서 semester → semesterTerm으로 교체 및 관련 테스트 설명/검증 업데이트. |
컴포넌트 업데이트 — 어워드 에디터frontend/src/pages/AdminPage/tabs/ClubIntroEditTab/components/AwardEditor/AwardEditor.tsx |
에디터 내 정렬값, 키 생성, 중복 검사, 새 항목 생성 등 모든 award.semester 참조를 award.semesterTerm으로 교체. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- [refactor] 동아리 설명 award의 semesterTerm과 year를 분리한다 #1046: 백엔드/타입에서 학기 표현을 연도 + SemesterTerm으로 분리한 변경과 프론트 정합성 관련.
- [refactor] year, semester 타입 분리에 따른 리팩토링 #1051:
Award.semester→semesterTerm타입/사용처 변경을 다룬 PR로 유사 코드 경합 가능. - [refactor] 동아리 소개 컴포넌트 리팩토링 및 유틸 함수 단위 테스트 추가 #1068:
formatSemesterLabel및getAwardKey관련 필드명 변경/사용처 수정과 중복되는 영역 존재.
Suggested labels
🛠Fix
Suggested reviewers
- oesnuj
- lepitaaar
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | PR 제목은 ClubIntroContent 어워드 렌더링 문제 해결을 명확하게 설명하고 있으며, 실제 변경사항(semester에서 semesterTerm으로의 필드명 변경)과 일치합니다. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
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 @coderabbitai help to get the list of available commands and usage tips.
lepitaaar
left a comment
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.
기존 semester를 사용하고있었네요.. 필드오류 수정 감사합니다
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: 1
🤖 Fix all issues with AI agents
In `@frontend/src/utils/awardHelpers.ts`:
- Line 4: Update the Award type to include an optional semesterTerm?:
SemesterTerm in your types (e.g., "@/types/club" Award interface) and then
remove the unsafe cast in frontend/src/utils/awardHelpers.ts; replace the
current semesterValue assignment that uses (award as any)?.semesterTerm ||
award?.semester with a nullish-coalescing lookup using the typed property (e.g.,
semesterValue = award.semesterTerm ?? award.semester) so you preserve type
safety and avoid falsy-value fallthrough.
🧹 Nitpick comments (1)
frontend/src/utils/awardHelpers.ts (1)
14-17: 중복 로직을 헬퍼 함수로 추출하세요.동일한 semester 값 추출 로직이 두 함수에서 반복됩니다. DRY 원칙에 따라 헬퍼 함수로 추출하는 것을 권장합니다.
또한,
semesterValue가undefined일 경우 키가"2024-undefined-0"형태가 되어 동일한 year와 index를 가진 항목들 간에 키 충돌이 발생할 수 있습니다.♻️ 권장 리팩토링
+const getSemesterValue = (award: Award): SemesterTerm | undefined => { + return award?.semesterTerm ?? award?.semester; +}; + export const formatSemesterLabel = (award: Award): string | null => { - const semesterValue = (award as any)?.semesterTerm || award?.semester; + const semesterValue = getSemesterValue(award); if (award?.year && semesterValue) { const semesterLabel = semesterValue === SemesterTerm.FIRST ? '1학기' : '2학기'; return `${award.year} ${semesterLabel}`; } return null; }; export const getAwardKey = (award: Award, index: number): string => { - const semesterValue = (award as any)?.semesterTerm || award?.semester; - return `${award.year}-${semesterValue}-${index}`; + const semesterValue = getSemesterValue(award); + return `${award.year}-${semesterValue ?? 'unknown'}-${index}`; };
- AwardEditor.tsx의 모든 참조 수정
lepitaaar
left a comment
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.
필드 전부변경하신거 좋습니다~
#️⃣연관된 이슈
📝작업 내용
중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.