-
Notifications
You must be signed in to change notification settings - Fork 2
feat : 서버 페치 실패시 빌드 막도록 수정 #335
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
base: main
Are you sure you want to change the base?
Conversation
Walkthrough이 변경사항은 대학 관련 API 및 페이지 컴포넌트들에 걸쳐 일관된 에러 처리 방식을 도입합니다. 이전에는 서버 응답 실패 시 빈 배열이나 폴백 값을 반환하던 방식을 버리고, 이제는 명시적으로 에러를 발생시키는 방식으로 전환됩니다. 또한 일부 페이지에서는 반환된 데이터의 유효성을 검증하고 필요한 데이터가 없을 경우 에러를 던지도록 강화되었습니다. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested reviewers
변경사항 상세 분석1. getRecommendedUniversity.ts
2. getSearchUniversitiesByText.ts
3. getUniversityDetail.ts
4. (home)/page.tsx
5. community/[boardCode]/page.tsx
6. university/[id]/page.tsx
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🔇 Additional comments (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/apis/universities/server/getRecommendedUniversity.ts (1)
7-16: 패턴 일관성을 위해 에러 처리 추가 권장다른 서버 페치 함수들(
getUniversityDetail,getSearchUniversitiesByText)은!result.ok시 에러를 던지지만, 이 함수는 호출자에게 검증을 위임하고 있습니다. 현재 홈 페이지에서 검증을 수행하고 있지만, 일관된 에러 처리 패턴을 위해 이 함수에서도 에러를 던지는 것을 고려해보세요.🔎 제안하는 리팩토링
/** * 추천 대학 목록을 가져옵니다. - * @returns ServerFetchResult - 호출 측에서 result.ok 체크 필요 */ const getRecommendedUniversity = async () => { const endpoint = "/univ-apply-infos/recommend"; const res = await serverFetch<GetRecommendedUniversityResponse>(endpoint); + + if (!res.ok) { + throw new Error(`Failed to fetch recommended universities: ${res.error}`); + } + - return res; + return res.data; };호출하는 곳(src/app/(home)/page.tsx)도 함께 수정:
- const recommendedUniversitiesResponse = await getRecommendedUniversity(); - - // 빌드 시 필수 데이터 검증 - if (!recommendedUniversitiesResponse.ok) { - throw new Error("Failed to fetch recommended universities for home page"); - } - - const recommendedUniversities = recommendedUniversitiesResponse.data.recommendedUniversities; + const recommendedUniversitiesData = await getRecommendedUniversity(); + const recommendedUniversities = recommendedUniversitiesData.recommendedUniversities;
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/apis/mentor/legacy/patchConfirmMentoring.tssrc/apis/universities/server/getRecommendedUniversity.tssrc/apis/universities/server/getSearchUniversitiesByText.tssrc/apis/universities/server/getUniversityDetail.tssrc/app/(home)/page.tsxsrc/app/community/[boardCode]/page.tsxsrc/app/university/[id]/page.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: manNomi
Repo: solid-connection/solid-connect-web PR: 242
File: src/components/ui/TabSelector.tsx:10-11
Timestamp: 2025-08-12T09:41:44.182Z
Learning: manNomi prefers to keep reusable UI components simple and focused on core functionality rather than adding many features. They don't want to over-engineer flexible/reusable UI components at the initial stage.
Learnt from: manNomi
Repo: solid-connection/solid-connect-web PR: 245
File: src/components/mentor/MentorChatCard/index.tsx:17-21
Timestamp: 2025-08-24T11:14:34.297Z
Learning: manNomi prefers not to receive accessibility suggestions or recommendations during code reviews.
Learnt from: manNomi
Repo: solid-connection/solid-connect-web PR: 245
File: src/api/auth/client/usePostLogout.ts:17-33
Timestamp: 2025-08-24T11:13:08.477Z
Learning: manNomi prefers to prioritize user experience over perfect state consistency in auth flows. Specifically, in logout scenarios, they prefer to keep tokens intact on API failure to avoid forcing users to re-login, even if it means temporary UI state inconsistency.
Learnt from: manNomi
Repo: solid-connection/solid-connect-web PR: 245
File: src/api/auth/client/useDeleteUserAccount.ts:17-27
Timestamp: 2025-08-24T11:11:40.758Z
Learning: manNomi prefers optimistic navigation in auth-related flows (like account deletion) to prevent race conditions where token clearing before navigation could cause intermediate redirects to login page due to pending async requests failing.
Learnt from: manNomi
Repo: solid-connection/solid-connect-web PR: 242
File: src/types/mentor.ts:70-73
Timestamp: 2025-08-12T04:07:04.134Z
Learning: manNomi prefers using Korean labels directly in enum values (e.g., MentorTab.MY_MENTEE = "나의 멘티") over separating enum keys from UI labels for efficiency and intuitiveness, considering scalability concerns as excessive for their current project needs.
🧬 Code graph analysis (2)
src/app/(home)/page.tsx (2)
src/apis/universities/server/getSearchUniversitiesByText.ts (1)
getCategorizedUniversities(34-56)src/apis/universities/server/index.ts (1)
getCategorizedUniversities(4-4)
src/apis/universities/server/getSearchUniversitiesByText.ts (1)
src/apis/universities/server/index.ts (2)
getAllUniversities(4-4)getUniversitiesByText(4-4)
🪛 GitHub Actions: CI
src/apis/mentor/legacy/patchConfirmMentoring.ts
[error] 3-3: TypeScript error: Module '../api' has no exported member 'ConfirmMentoringRequest' (tsc --noEmit).
🪛 GitHub Check: Lint & Type Check
src/apis/mentor/legacy/patchConfirmMentoring.ts
[failure] 9-9:
Property 'patchConfirmMentoring' does not exist on type '{ getMentorMyProfile: () => Promise; getMentoringList: (page: number, size?: number) => Promise; ... 10 more ...; getMatchedMentors: (params: { ...; }) => Promise<...>; }'.
[failure] 3-3:
Module '"../api"' has no exported member 'ConfirmMentoringResponse'.
[failure] 3-3:
Module '"../api"' has no exported member 'ConfirmMentoringRequest'.
🔇 Additional comments (8)
src/apis/universities/server/getUniversityDetail.ts (1)
8-10: 좋습니다! 명확한 에러 처리로 빌드 안정성 확보서버 페치 실패 시 구체적인 에러 메시지(ID와 에러 내용 포함)와 함께 예외를 발생시켜, 빌드 타임에 문제를 조기에 감지할 수 있도록 했습니다.
src/apis/universities/server/getSearchUniversitiesByText.ts (2)
17-21: 명확한 에러 처리로 빌드 안정성 향상서버 응답 실패 시 구체적인 에러와 함께 예외를 발생시켜 빌드가 진행되지 않도록 했습니다.
25-31: 빈 응답 검증 추가로 데이터 무결성 확보대학 목록이 비어있을 경우에도 에러를 발생시켜, 불완전한 데이터로 빌드가 진행되는 것을 방지했습니다.
src/app/university/[id]/page.tsx (2)
15-17: 정적 경로 생성 시 데이터 검증 강화빌드 타임에 대학 목록을 가져오지 못한 경우 명확한 에러를 발생시켜, 불완전한 정적 페이지 생성을 방지합니다.
34-34: 메타데이터 생성 실패 시 조기 감지대학 상세 정보를 가져오지 못한 경우 에러를 발생시켜, SEO 메타데이터가 누락된 페이지가 생성되는 것을 방지합니다.
src/app/community/[boardCode]/page.tsx (1)
45-52: 커뮤니티 페이지 데이터 페치 실패 시 빌드 중단게시글 목록을 가져오지 못한 경우 에러를 발생시켜, 빈 데이터로 ISR 페이지가 생성되는 것을 방지합니다. 성공 시에만 React Query 캐시에 데이터를 설정하도록 제어 흐름이 명확합니다.
src/app/(home)/page.tsx (2)
70-77: 홈페이지 추천 대학 데이터 검증 추가추천 대학 목록 페치 실패 시 빌드를 중단하여, 핵심 콘텐츠가 누락된 홈페이지가 배포되는 것을 방지합니다.
82-84: 권역별 대학 목록 데이터 검증 추가권역별 대학 목록이 비어있을 경우 빌드를 중단하여, 대학 목록 섹션이 제대로 표시되지 않는 페이지가 생성되는 것을 방지합니다.
관련 이슈
작업 내용