Fix: data-fetch 데이터 리패치 - #146
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
개요API 클라이언트를 변경 사항
예상 코드 리뷰 소요 시간🎯 2 (단순) | ⏱️ ~10분
관련 PR
제안 라벨
제안 리뷰어
시
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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 |
|
🏷️ Labeler has automatically applied labels based on your PR title, branch name, or commit message. |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/shared/components/main/components/board/Boardgame.tsx(2 hunks)src/shared/main/api/getHasBoardStamp.ts(2 hunks)src/shared/main/api/getPlaceDetail.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/shared/main/api/getPlaceDetail.ts (4)
src/shared/api/instance.ts (1)
apiWithToken(14-17)src/shared/types/authtypes.ts (1)
ApiResponse(1-6)src/shared/main/queries/useGetPlaceDetail.ts (2)
getPlaceDetail(7-7)placeId(4-10)src/shared/api/main/node/api/stampAcquire.ts (1)
placeId(4-13)
src/shared/main/api/getHasBoardStamp.ts (5)
src/shared/api/instance.ts (1)
apiWithToken(14-17)src/shared/main/api/getStampStatus.ts (2)
Promise(10-15)StampStatus(4-8)src/shared/api/main/node/api/stampAcquire.ts (1)
placeId(4-13)src/shared/api/main/node/types/stampAcquireTypes.ts (2)
StampAcquireResponse(14-26)PostcardData(6-12)src/pages/main/node/[placeId].tsx (1)
pos(79-107)
src/shared/components/main/components/board/Boardgame.tsx (2)
src/pages/main/node/[placeId].tsx (2)
res(92-100)router(20-191)src/shared/components/map/result/components/ResultList.tsx (3)
place(36-52)place(14-24)ResultListProps(7-9)
🔇 Additional comments (4)
src/shared/components/main/components/board/Boardgame.tsx (2)
13-13: 데이터 경로 수정이 올바르게 적용되었습니다.
data?.result?.places에서data?.data?.places로의 변경이 API 응답 구조와 일치합니다. 이 변경으로 스탬프 표시 문제가 해결됩니다.
42-42: 리뷰 코멘트 무효 - 양쪽 모두 이미 number 타입입니다.검증 결과,
Place인터페이스(src/shared/main/api/getHasBoardStamp.ts)에서placeId는number타입이고,boardData의cell.placeId도 모두 숫자로 정의되어 있습니다. 따라서Number()변환이 불필요하며, 타입 불일치는 발생하지 않습니다. 현재 코드는 올바른 상태입니다.src/shared/main/api/getHasBoardStamp.ts (2)
1-1: API 클라이언트 마이그레이션이 올바르게 적용되었습니다.
apiAuth에서apiWithToken으로의 전환이 다른 API 파일들과 일관되게 적용되었습니다.Also applies to: 19-20
9-16: API 응답 구조 변경이 올바르게 적용되었습니다.검증 결과:
- ✓
StampStatusResponse인터페이스의data필드 구조 확인됨 (data: { places: Place[] })- ✓ 함수 반환값과 사용처(
Boardgame.tsx)의 접근 방식이 일치 (data?.data?.places)- ✓ 이전
result.places패턴 완전히 제거됨모든 변경사항이 일관성 있게 적용되었으므로 추가 수정이 필요하지 않습니다.
| @@ -1,4 +1,4 @@ | |||
| import { apiAuth } from '@/shared/api/instance'; | |||
| import { apiWithToken } from '@/shared/api/instance'; | |||
There was a problem hiding this comment.
🧩 Analysis chain
API 클라이언트 마이그레이션 확인이 필요합니다.
apiAuth에서 apiWithToken으로의 전환은 올바르게 구현되었습니다. 하지만 코드베이스 전체에서 apiAuth의 다른 사용처가 모두 마이그레이션되었는지 확인이 필요합니다.
다음 스크립트를 실행하여 apiAuth의 남은 사용처를 확인하세요:
Also applies to: 14-17
🏁 Script executed:
#!/bin/bash
# Description: apiAuth의 남은 사용처를 찾아 마이그레이션이 완료되었는지 확인
# apiAuth import 및 사용 검색
echo "=== apiAuth import 검색 ==="
rg -n "from.*apiAuth|import.*apiAuth" --type=ts --type=tsx
echo -e "\n=== apiAuth 직접 사용 검색 ==="
rg -n "apiAuth\." --type=ts --type=tsx -A 2Length of output: 107
파일 타입 감지 오류로 인해 재검증이 필요합니다. 수정된 스크립트로 다시 확인하겠습니다.
---
🏁 Script executed:
```shell
#!/bin/bash
# Description: apiAuth의 남은 사용처를 찾아 마이그레이션 완료 여부 확인 (수정된 버전)
# apiAuth import 검색 (파일 타입 제한 없음)
echo "=== apiAuth import 검색 ==="
rg "from.*apiAuth|import.*apiAuth" -n
echo -e "\n=== apiAuth 직접 사용 검색 ==="
rg "apiAuth\." -n -A 2
echo -e "\n=== apiAuth 정의/내보내기 검색 ==="
rg "export.*apiAuth|const apiAuth|apiAuth\s*=" -n -A 2
echo -e "\n=== 전체 코드베이스에서 'apiAuth' 검색 ==="
rg "apiAuth" -n --no-heading | head -20
Length of output: 1341
API 클라이언트 마이그레이션이 완료되지 않았습니다.
검증 결과, 다음 파일들에서 apiAuth가 여전히 사용 중입니다:
src/shared/api/auth.ts:6-apiAuth.post()사용src/shared/api/course/api/getCourseSession.ts:5-apiAuth.get()사용
apiWithToken으로의 마이그레이션을 완료하려면 이 파일들도 함께 업데이트해야 합니다. 또는 이 파일들이 의도적으로 apiAuth를 사용해야 한다면 명확히 해 주세요.
🔥 작업 내용
data.placesresult.placesconst places = data?.data?.places ?? [];로 수정하여 정상 동작 확인🤔 추후 작업 사항
🔗 이슈
PR Point (To Reviewer)
placeId매칭 시 유효하지 않은 데이터가 없는지 검토 요청드립니다.📸 피그마 스크린샷 or 기능 GIF
(작업 내역 스크린샷 첨부)
Summary by CodeRabbit
릴리스 노트
버그 수정
리팩토링