feat: 기사 반려 내역 조회 페이지 페이지네이션 추가 - #35
Conversation
📝 WalkthroughWalkthrough반려 요청 조회가 단발 조회에서 커서 기반 무한 스크롤로 변경되었습니다. API 응답에 페이지네이션 정보가 추가되었고, React Query 훅과 목록 화면이 다음 페이지 로딩 및 실패 재시도를 처리합니다. Changes반려 요청 무한 스크롤 페이징
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RejectedRequestsPage
participant useRejectedEstimateRequests
participant getRejectedEstimateRequests
participant RejectionsAPI
RejectedRequestsPage->>useRejectedEstimateRequests: 초기 반려 요청 조회
useRejectedEstimateRequests->>getRejectedEstimateRequests: cursor와 limit 전달
getRejectedEstimateRequests->>RejectionsAPI: 페이지 요청
RejectionsAPI-->>useRejectedEstimateRequests: items와 pagination 반환
useRejectedEstimateRequests-->>RejectedRequestsPage: 목록과 다음 페이지 상태 제공
RejectedRequestsPage->>RejectedRequestsPage: sentinel 교차 감지
RejectedRequestsPage->>useRejectedEstimateRequests: fetchNextPage() 호출
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/api/moverEstimateRequests.ts (1)
80-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win페이지 크기 기본값을 명명된 상수로 분리하세요.
새로 추가된
10은 목록 정책을 숨깁니다. 페이지 크기를 조정하거나 다른 호출부와 맞출 때 누락되지 않도록 의미 있는 상수로 관리하세요.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/api/moverEstimateRequests.ts` around lines 80 - 81, Extract the default page-size value used by getRejectedEstimateRequests into a clearly named module-level constant, and use that constant as the function parameter default. Keep the existing limit behavior unchanged while making the pagination policy reusable and easy to update.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/api/moverEstimateRequests.ts`:
- Around line 80-81: Extract the default page-size value used by
getRejectedEstimateRequests into a clearly named module-level constant, and use
that constant as the function parameter default. Keep the existing limit
behavior unchanged while making the pagination policy reusable and easy to
update.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7ae05e75-b365-4e7f-8dc0-0d8cebd1ebaa
📒 Files selected for processing (4)
src/components/estimate/RejectedRequestsPage.tsxsrc/hooks/useMoverEstimateRequests.tssrc/lib/api/moverEstimateRequests.tssrc/types/moverEstimateRequest.ts
juengseulki
left a comment
There was a problem hiding this comment.
📋 PR 리뷰
👍 좋았던 점
- 기존 일반 조회를 useInfiniteQuery로 자연스럽게 전환해 페이지별 데이터를 React Query에서 관리하도록 구성했습니다.
- 백엔드의 nextCursor를 pageParam으로 그대로 전달해 커서 페이지네이션 흐름이 명확합니다.
- 각 페이지의 items를 flatMap으로 합쳐 기존 카드 목록 렌더링 구조를 크게 변경하지 않았습니다.
- IntersectionObserver에 rootMargin을 적용해 사용자가 목록 끝에 완전히 도달하기 전에 다음 데이터를 미리 요청하도록 처리했습니다.
- 다음 페이지 존재 여부와 로딩 상태를 확인해 중복 요청을 방지했습니다.
- Observer를 cleanup에서 해제해 컴포넌트 재렌더링이나 언마운트 시 구독이 남지 않도록 처리했습니다.
- 초기 조회 실패와 다음 페이지 조회 실패를 구분해, 기존 목록을 유지하면서 다음 페이지만 재시도할 수 있도록 구성한 점이 좋았습니다.
- 백엔드 응답 구조인 items, pagination.nextCursor, pagination.hasNextPage에 맞춰 프론트 타입도 정확하게 변경했습니다.
🔍 확인 및 제안
인라인 코멘트로 아래 내용을 남겼습니다.
- 다음 페이지 재시도 버튼을 누른 동안에도 문구가 계속 다시 시도로 유지됩니다. 초기 조회 오류 UI처럼 로딩 문구 변경이나 버튼 비활성화를 적용하면 중복 클릭을 막고 진행 상태를 더 명확히 전달할 수 있을 것 같습니다.
전체적으로 백엔드에서 추가된 커서 페이지네이션 응답을 프론트의 useInfiniteQuery와 잘 연결했고, 초기 오류와 추가 조회 오류까지 나누어 처리한 점이 좋았습니다. 현재 변경에서 기능상 수정이 필요한 부분은 확인되지 않았습니다. 수고하셨습니다! 😊
📋 작업 내용
🔥 변경 사항
✅ 체크리스트
📷 스크린샷 (선택)
🔗 관련 이슈
Closes #
💬 To Reviewer
필요하시다면 백엔드에서는 feat: 기사 반려 내역 조회 API moving-backend#62 해당 PR 확인하시면 될 것 같습니다!
Summary by CodeRabbit