Skip to content

Conversation

@LeeCh0129
Copy link
Contributor

@LeeCh0129 LeeCh0129 commented Aug 4, 2025

📌 변경 사항 개요

예약 및 프로필 데이터 실시간 업데이트

📝 상세 내용

  • 예약 내역, 현황 대시보드 새 예약 실시간, 프로필 이미지 페이지 이동 시 동기화 문제

🔗 관련 이슈

🖼️ 스크린샷(선택사항)

💡 참고 사항

Summary by CodeRabbit

  • 개선 사항
    • 창에 다시 포커스하거나 컴포넌트가 마운트될 때 대시보드, 내 프로필, 예약 관련 데이터가 자동으로 최신 상태로 갱신됩니다.
    • 사용자에게 더 신뢰할 수 있는 최신 정보가 제공됩니다.

@LeeCh0129 LeeCh0129 self-assigned this Aug 4, 2025
@LeeCh0129 LeeCh0129 added the 🔨 Refactor 코드 리팩토링 label Aug 4, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

useQueryuseInfiniteQuery를 사용하는 여러 커스텀 훅에서 refetchOnWindowFocus: truerefetchOnMount: true 옵션이 추가되었습니다. 이로 인해 브라우저 창이 포커스를 얻거나 컴포넌트가 마운트될 때마다 쿼리가 자동으로 재요청됩니다. 로직이나 에러 처리 방식에는 변화가 없습니다.

Changes

Cohort / File(s) Change Summary
Dashboard 관련 쿼리 옵션 추가
src/hooks/useDashboardQueries.ts
모든 대시보드 관련 useQuery, useInfiniteQueryrefetchOnWindowFocus: true, refetchOnMount: true 옵션 추가
마이페이지 프로필 쿼리 옵션 추가
src/hooks/useMyPageQueries.ts
useMyProfile 훅의 useQuery에 위 두 옵션 추가
예약 내역 쿼리 옵션 추가
src/hooks/useReservationQueries.ts
useMyReservationsuseInfiniteQuery에 위 두 옵션 추가

Sequence Diagram(s)

(생략: 단순 옵션 추가로 인한 컨트롤 플로우 변화 없음)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
예약 승인 후 예약 내역 실시간 업데이트 이슈 (#153)

Assessment against linked issues: Out-of-scope changes

(해당 이슈의 목적과 무관한 변경사항 없음)

Suggested labels

🐞 bug

Suggested reviewers

  • BokyungCodes
  • evaain706
  • minimo-9

Poem

창이 반짝, 토끼가 깡총
데이터는 즉시, 실시간으로 통!
예약 내역 새로고침,
사용자는 미소짓지요 :)

( ˘▽˘)っ━☆゚.*・。

토끼의 코드, 오늘도 완벽!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74c3ef3 and 648b15e.

📒 Files selected for processing (3)
  • src/hooks/useDashboardQueries.ts (4 hunks)
  • src/hooks/useMyPageQueries.ts (1 hunks)
  • src/hooks/useReservationQueries.ts (1 hunks)
🔇 Additional comments (3)
src/hooks/useReservationQueries.ts (1)

41-42: 실시간 업데이트를 위한 적절한 설정입니다.

예약 데이터의 실시간 업데이트를 위해 refetchOnWindowFocusrefetchOnMount 옵션을 추가한 것이 PR 목표와 완벽히 일치합니다. 이는 예약 승인 후 데이터가 즉시 반영되지 않는 문제(#153)를 효과적으로 해결할 것입니다.

5분의 staleTime과 함께 사용되어 불필요한 요청을 방지하면서도 필요할 때 데이터를 새로 가져오는 균형잡힌 전략입니다.

src/hooks/useDashboardQueries.ts (1)

32-33: 대시보드 전체에 일관된 실시간 업데이트 구현.

모든 대시보드 쿼리에 refetchOnWindowFocusrefetchOnMount 옵션을 일관되게 적용한 것이 훌륭합니다. 특히 예약 관련 데이터(useReservedSchedules, useActivityReservations)는 2분의 짧은 staleTime을, 일반 활동 데이터는 5분의 staleTime을 사용하여 데이터의 중요도에 따른 적절한 캐시 전략을 구현했습니다.

이는 예약 승인 후 대시보드가 즉시 업데이트되어야 한다는 PR 목표를 완벽히 달성합니다.

Also applies to: 53-54, 65-66, 98-99

src/hooks/useMyPageQueries.ts (1)

27-28: 프로필 데이터의 실시간 업데이트 구현 완료.

프로필 데이터에 refetchOnWindowFocusrefetchOnMount 옵션을 추가하여 프로필 이미지 페이지 이동 시 동기화 문제를 해결한 것이 적절합니다. 5분의 staleTime은 프로필 데이터의 특성상 적합한 설정입니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/153

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
🪧 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 @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@BokyungCodes BokyungCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

까도 까도 계속 나오는 양파같은 이슈들이네요..

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74c3ef3 and 648b15e.

📒 Files selected for processing (3)
  • src/hooks/useDashboardQueries.ts (4 hunks)
  • src/hooks/useMyPageQueries.ts (1 hunks)
  • src/hooks/useReservationQueries.ts (1 hunks)
🔇 Additional comments (2)
src/hooks/useMyPageQueries.ts (1)

27-28: 프로필 데이터 refetch 최적화 고려 필요

refetchOnWindowFocus: true와 5분 staleTime 조합으로 인해 윈도우 포커스 시마다 데이터가 refetch될 수 있습니다. 프로필 데이터는 자주 변경되지 않으므로 성능 최적화를 위해 다음을 고려해보세요:

  const query = useQuery({
    queryKey: QUERY_KEYS.PROFILE,
    queryFn: getMyProfile,
    staleTime: 1000 * 60 * 5,
-   refetchOnWindowFocus: true,
+   refetchOnWindowFocus: 'always',
    refetchOnMount: true,
  });

또는 staleTime 내에서는 refetch하지 않도록 기본값을 사용하는 것을 검토해보세요.

Likely an incorrect or invalid review comment.

src/hooks/useDashboardQueries.ts (1)

32-33: 대시보드 실시간 업데이트 구현 우수함

예약 관련 대시보드 데이터에 대한 실시간 업데이트 구현이 적절합니다:

  • 예약 현황은 자주 변경되므로 refetchOnWindowFocus가 유용함
  • 예약/스케줄 관련 쿼리의 짧은 staleTime (2분)이 적절함
  • 모든 대시보드 훅에 일관성 있게 적용됨

이는 이슈 #153의 예약 승인 후 실시간 업데이트 문제를 효과적으로 해결합니다.

Also applies to: 53-54, 65-66, 98-99

Comment on lines +41 to +42
refetchOnWindowFocus: true,
refetchOnMount: true,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

예약 데이터 실시간 업데이트 구현 확인, staleTime 일관성 검토 필요

이슈 #153의 핵심 문제인 예약 내역 실시간 업데이트가 구현되었습니다. 하지만 staleTime 일관성을 검토해보세요:

  return useInfiniteQuery({
    queryKey: [...RESERVATION_QUERY_KEYS.RESERVATIONS, status],
    queryFn: ({ pageParam = 0 }) =>
      getMyReservations({
        cursorId: pageParam,
        size: 10,
        status,
      }),
    getNextPageParam: (lastPage) => {
      return lastPage.reservations.length === 10
        ? lastPage.cursorId
        : undefined;
    },
    initialPageParam: 0,
-   staleTime: 1000 * 60 * 5,
+   staleTime: 1000 * 60 * 2, // 대시보드 쿼리와 일관성 유지
    refetchOnWindowFocus: true,
    refetchOnMount: true,
  });

예약 데이터는 대시보드와 동일한 빈도로 업데이트되어야 하므로 2분 staleTime이 더 적절할 수 있습니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
refetchOnWindowFocus: true,
refetchOnMount: true,
return useInfiniteQuery({
queryKey: [...RESERVATION_QUERY_KEYS.RESERVATIONS, status],
queryFn: ({ pageParam = 0 }) =>
getMyReservations({
cursorId: pageParam,
size: 10,
status,
}),
getNextPageParam: (lastPage) => {
return lastPage.reservations.length === 10
? lastPage.cursorId
: undefined;
},
initialPageParam: 0,
staleTime: 1000 * 60 * 2, // 대시보드 쿼리와 일관성 유지
refetchOnWindowFocus: true,
refetchOnMount: true,
});
🤖 Prompt for AI Agents
In src/hooks/useReservationQueries.ts around lines 41 to 42, the current
staleTime setting does not match the desired update frequency for reservation
data. To ensure reservation data updates in real-time and aligns with the
dashboard's update interval, change the staleTime value to 2 minutes (120000
milliseconds). This adjustment will maintain consistency in data freshness
across components.

@LeeCh0129 LeeCh0129 merged commit c0bbca2 into develop Aug 4, 2025
2 checks passed
@LeeCh0129 LeeCh0129 deleted the fix/153 branch August 4, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] 예약 승인 후 예약 내역 실시간 업데이트 이슈

4 participants