Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/hooks/useDashboardQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const useMyActivities = () => {
queryKey: DASHBOARD_QUERY_KEYS.MY_ACTIVITIES,
queryFn: getMyActivities,
staleTime: 1000 * 60 * 5,
refetchOnWindowFocus: true,
refetchOnMount: true,
});
};

Expand All @@ -48,6 +50,8 @@ export const useMonthlyReservationDashboard = (
queryFn: () => getMonthlyReservationDashboard(activityId, year, month),
enabled: !!activityId,
staleTime: 1000 * 60 * 5,
refetchOnWindowFocus: true,
refetchOnMount: true,
});
};

Expand All @@ -58,6 +62,8 @@ export const useReservedSchedules = (activityId: number, date: string) => {
queryFn: () => getReservedSchedules(activityId, date),
enabled: !!activityId && !!date,
staleTime: 1000 * 60 * 2,
refetchOnWindowFocus: true,
refetchOnMount: true,
});
};

Expand Down Expand Up @@ -89,6 +95,8 @@ export const useActivityReservations = (
initialPageParam: 0,
enabled: !!activityId && !!params.scheduleId,
staleTime: 1000 * 60 * 2,
refetchOnWindowFocus: true,
refetchOnMount: true,
});
};

Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useMyPageQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const useMyProfile = () => {
queryKey: QUERY_KEYS.PROFILE,
queryFn: getMyProfile,
staleTime: 1000 * 60 * 5,
refetchOnWindowFocus: true,
refetchOnMount: true,
});

useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useReservationQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const useMyReservations = (status?: ReservationStatus) => {
},
initialPageParam: 0,
staleTime: 1000 * 60 * 5,
refetchOnWindowFocus: true,
refetchOnMount: true,
Comment on lines +41 to +42
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.

});
};

Expand Down