[fix] 클럽 지원서 조회 시 오류 해결 및 Spinner 적용 및 예외 메시지 개선#505
Conversation
✅ Deploy Preview for moadong ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning
|
| 파일/경로 | 변경 요약 |
|---|---|
| frontend/src/pages/AdminPage/application/answer/AnswerApplicationForm.tsx | Spinner 컴포넌트 도입, clubId 전달 방식 수정, 로딩/에러 처리 분기 재구성 |
Sequence Diagram(s)
sequenceDiagram
participant User
participant AnswerApplicationForm
participant useGetClubDetail
participant useGetApplication
participant Spinner
User->>AnswerApplicationForm: 페이지 접근
AnswerApplicationForm->>useGetClubDetail: clubId로 동아리 정보 요청
AnswerApplicationForm->>useGetApplication: clubId로 지원서 정보 요청
alt 로딩 중
AnswerApplicationForm->>Spinner: 로딩 표시
else 에러 발생
AnswerApplicationForm-->>User: "지원서 정보를 불러오는 중 오류가 발생했습니다." 메시지 표시
else 데이터 미존재
AnswerApplicationForm-->>User: "지원서 정보를 불러오지 못했습니다." 메시지 표시
else 정상
AnswerApplicationForm-->>User: 지원서 폼 렌더링
end
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| 지원서 폼 조회 API 연동, 에러/로딩/성공 상태 처리 (MOA-38) | ✅ | |
| 지원서 최초 작성/수정 API 연동, 사용자/관리자 모드 분기, 질문 유형별 렌더링 및 상태 관리 (MOA-38) | ❓ | 해당 PR에서는 폼 조회 및 상태 처리만 다루고, 나머지 항목의 구현 여부는 코드에서 확인되지 않음 |
Assessment against linked issues: Out-of-scope changes
(해당 사항 없음)
Possibly related PRs
- Moadong/moadong#490: 동일 컴포넌트의 로딩 및 에러 처리 로직 리팩터링과 직접적인 연관이 있습니다.
- Moadong/moadong#493: AnswerApplicationForm.tsx에서 질문 렌더링 및 UI/상태 관리 개선 관련 변경이 있어, 본 PR과 UI/로직 측면에서 연관성이 높습니다.
Suggested reviewers
- seongwon030
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/pages/AdminPage/application/answer/AnswerApplicationForm.tsx(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/pages/AdminPage/application/answer/AnswerApplicationForm.tsx (3)
frontend/src/hooks/queries/club/useGetClubDetail.ts (1)
useGetClubDetail(6-20)frontend/src/hooks/queries/application/useGetApplication.ts (1)
useGetApplication(4-10)frontend/src/hooks/useAnswers.ts (1)
useAnswers(4-33)
🔇 Additional comments (5)
frontend/src/pages/AdminPage/application/answer/AnswerApplicationForm.tsx (5)
11-11: Spinner 컴포넌트 import 추가 승인UX 개선을 위한 Spinner 컴포넌트 import가 적절하게 추가되었습니다.
17-18: 훅 호출 방식 개선 승인
clubId를 직접 전달하도록 변경한 것이 좋습니다. 15번 라인에서 이미clubId의 null 체크가 완료되었으므로 안전합니다.
22-22: 로딩 상태 UI 개선 승인기존의 "로딩 중..." 텍스트를 Spinner 컴포넌트로 교체하여 사용자 경험이 개선되었습니다.
24-26: 통합된 에러 처리 로직 승인
useGetClubDetail과useGetApplication훅의 에러를 통합하여 처리하는 방식이 깔끔하고 효율적입니다.
28-35: 데이터 존재 여부 확인 로직 승인
formData와clubDetail모두의 존재 여부를 확인하여 사용자에게 명확한 메시지를 제공하는 로직이 잘 구현되었습니다. 이는 null reference 에러를 방지하고 사용자에게 적절한 피드백을 제공합니다.
✨ 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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the issue where the club application details were being retrieved in the wrong sequence by adjusting the hook call order, and improves user feedback by replacing the loading text with a Spinner and providing more descriptive error messages.
- Resolves hook call ordering between useGetApplication and useGetClubDetail.
- Replaces the plain loading text with a Spinner component for consistency.
- Adds specific error messages for application data retrieval failures.
Comments suppressed due to low confidence (1)
frontend/src/pages/AdminPage/application/answer/AnswerApplicationForm.tsx:28
- Consider clarifying the error messaging here to specify which data (application or club details) failed to load, so users receive more targeted guidance.
if (!formData || !clubDetail) {

#️⃣연관된 이슈
📝작업 내용
useAnswers();훅이 return문보다 뒤에서 호출되어 React 훅 규칙을 위반한 문제가 있었고, 이를 뒤로 이동시켜 해결했습니다

클럽 상세 정보(clubDetail) 또는 지원서 데이터(formData)가 없을 때 null 참조로 인한 오류 방지
로딩 시 "로딩 중..." 텍스트를 Spinner 컴포넌트로 교체하여 UX 개선
지원서가 없거나 불러오지 못했을 경우 사용자에게 구체적인 예외 메시지를 안내
✅ 확인 사항
데이터가 정상적으로 없을 경우에도 예외 메시지로 안내됨
잘못된 접근 시 무한 스피너 발생하지 않음
기존 정상 흐름(form 출력)은 그대로 유지됨
🫡 참고사항
https://velog.io/@sinf/Rendered-more-hooks-than-during-the-previous-render
Summary by CodeRabbit