Skip to content

Conversation

@manNomi
Copy link
Contributor

@manNomi manNomi commented Dec 28, 2025

관련 이슈

  • resolves: #이슈 번호

작업 내용

  • 서버 페치 실패시 애러 처리

  • 대학정보 페이지는 모두 정적으로 처리됩니다

  • 정보는 서버에서 변경이 가능하며 6개월 주기로 변경 가능성이 있습니다

  • 데이터를 인라인으로 박으면 좋겠지만 (성능 등) 데이터 관리는 서버에 일임하기 위해서

  • 빌드 시점에 데이터를 대학 정보를 모두 가져와서 관리하도록 하고 있습니다

  • 허나 빌드시점에 특정 이유로 서버 데이터를 가져오지 못하는 경우가 있습니다 (ex : 서버 이전과정에서 데이터베이스 유실)

  • 이경우 검수가 되지 못해서 한동안 대학 정보를 보지 못하던 버그가 존재했습니다

  • 따라서 대학 정보를 가져오지 못하는 것은 버그로 판단하고 빌드시점에서 애러를 발생하도록 수정했습니다

@manNomi manNomi requested a review from wibaek as a code owner December 28, 2025 15:08
@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

Walkthrough

이 변경사항은 대학 관련 API 및 페이지 컴포넌트들에 걸쳐 일관된 에러 처리 방식을 도입합니다. 이전에는 서버 응답 실패 시 빈 배열이나 폴백 값을 반환하던 방식을 버리고, 이제는 명시적으로 에러를 발생시키는 방식으로 전환됩니다. 또한 일부 페이지에서는 반환된 데이터의 유효성을 검증하고 필요한 데이터가 없을 경우 에러를 던지도록 강화되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • wibaek

변경사항 상세 분석

1. getRecommendedUniversity.ts

  • getRecommendedUniversity 함수 위에 JSDoc 주석을 추가하여 이 함수가 추천 대학 목록을 가져오며, 호출자가 result.ok를 확인해야 함을 명시했습니다.

2. getSearchUniversitiesByText.ts

  • getUniversitiesByText가 서버 응답이 정상이 아닐 때 빈 리스트를 반환하는 대신 에러를 발생시키도록 변경되었습니다.
  • 응답이 정상일 때 항상 response.data.univApplyInfoPreviews를 반환하며, 이전의 조건부 폴백 로직이 제거되었습니다.
  • getAllUniversities가 getUniversitiesByText를 빈 문자열과 함께 호출하고 결과를 직접 반환하도록 개선되었습니다.

3. getUniversityDetail.ts

  • serverFetch 결과가 정상이 아닐 경우, 함수가 universityId와 에러 정보를 포함한 에러를 발생시키도록 강화되었습니다.

4. (home)/page.tsx

  • getRecommendedUniversity의 반환값을 직접 사용하는 대신, 명시적으로 ok 여부를 확인하고 정상이 아니면 에러를 던지도록 수정되었습니다.
  • 그룹화된 대학 목록(allRegionsUniversityList)의 유효성을 검증하여, 데이터가 없거나 비어있으면 에러를 발생시킵니다.

5. community/[boardCode]/page.tsx

  • React Query 캐시 설정 로직이 재정렬되었습니다. 이제 fetch 실패 시 명시적으로 에러를 던지고, 성공 시에만 캐시를 업데이트합니다.

6. university/[id]/page.tsx

  • generateMetadata에서 universityData가 없을 때 폴백 타이틀을 반환하는 대신 에러를 발생시키도록 변경되었습니다.
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive PR 설명이 기본 구조는 따르고 있으나, 관련 이슈 번호가 '#이슈 번호' 템플릿 형태로 남아있고 특이 사항과 리뷰 요구사항 섹션이 완전히 누락되어 있습니다. 관련 이슈 번호를 구체적으로 입력하고, 특이 사항 및 리뷰 요구사항 섹션을 추가하여 PR 설명을 완성해 주세요.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항(서버 페치 실패시 에러 처리)을 명확하게 설명하고 있습니다.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 03026c7 and 468b675.

📒 Files selected for processing (7)
  • src/apis/mentor/legacy/patchConfirmMentoring.ts
  • src/apis/universities/server/getRecommendedUniversity.ts
  • src/apis/universities/server/getSearchUniversitiesByText.ts
  • src/apis/universities/server/getUniversityDetail.ts
  • src/app/(home)/page.tsx
  • src/app/community/[boardCode]/page.tsx
  • src/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: 권역별 대학 목록 데이터 검증 추가

권역별 대학 목록이 비어있을 경우 빌드를 중단하여, 대학 목록 섹션이 제대로 표시되지 않는 페이지가 생성되는 것을 방지합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant