-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX] 통계 페이지 QA 반영 #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] 통계 페이지 QA 반영 #233
Changes from all commits
1e6142c
42c9122
fbe7f89
e1b90fc
b57fea8
353c878
e8700fb
a6bc84d
b8be4b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| "use client"; | ||
|
|
||
| import { useQueryClient } from "@tanstack/react-query"; | ||
|
|
||
| import { | ||
| getGetCalendarQueryKey, | ||
| getGetDailyQueryKey, | ||
| getGetSummaryQueryKey, | ||
| } from "@/api/generated/endpoints/statistics/statistics"; | ||
|
|
||
| export const useStatisticsQueryInvalidation = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| const invalidateStatistics = () => { | ||
| queryClient.invalidateQueries({ queryKey: getGetSummaryQueryKey() }); | ||
| queryClient.invalidateQueries({ queryKey: getGetDailyQueryKey() }); | ||
| queryClient.invalidateQueries({ queryKey: getGetCalendarQueryKey() }); | ||
| }; | ||
|
Comment on lines
+14
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value Promise.all을 활용해 비동기 무효화 작업의 Promise를 반환해 보세요. 현재 이렇게 되면 호출부(예: Mutation의
관련하여 TanStack Query 공식 문서 - Query Invalidation 가이드를 확인해 보시면 더욱 도움이 될 것입니다. 📍 Affects 2 files
🤖 Prompt for AI Agents
yumin-kim2 marked this conversation as resolved.
|
||
|
|
||
| return { | ||
| invalidateStatistics, | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { | |
| getGetTodayQueryKey, | ||
| } from "@/api/generated/endpoints/home/home"; | ||
| import { useDeleteTodo } from "@/api/generated/endpoints/todo/todo"; | ||
| import { useStatisticsQueryInvalidation } from "@/hooks/statistics/use-statistics-query-invalidation"; | ||
|
|
||
| export interface DeleteTodoSubmitHandlers { | ||
| onSuccess: () => void; | ||
|
|
@@ -20,6 +21,7 @@ export interface DeleteTodoSubmitHandlers { | |
| export const useDeleteTodoSubmit = () => { | ||
| const { mutate: deleteTodo } = useDeleteTodo(); | ||
| const queryClient = useQueryClient(); | ||
| const { invalidateStatistics } = useStatisticsQueryInvalidation(); | ||
|
|
||
| const handleDelete = ( | ||
| todoId: number, | ||
|
|
@@ -31,6 +33,7 @@ export const useDeleteTodoSubmit = () => { | |
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: getGetHomeQueryKey() }); | ||
| queryClient.invalidateQueries({ queryKey: getGetTodayQueryKey() }); | ||
| invalidateStatistics(); | ||
| queryClient.invalidateQueries({ | ||
| queryKey: getGetFocusTodoQueryKey(), | ||
| }); | ||
|
Comment on lines
37
to
39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value 공통 쿼리 무효화 훅(Hook)으로의 분리 고려 현재 여러 컴포넌트나 훅에서 다만, 향후 유지보수와 코드 일관성을 위해 중복되는 무효화 로직을
깔끔하게 필요한 무효화 로직을 잘 추가해주셨네요! 👍 참고 문서: React Query Query Invalidation 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Tailwind의
last:모디파이어를 활용해 보세요.JS에서 배열 인덱스를 계산하여 조건부로 스타일을 적용하는 대신, Tailwind CSS의 의사 클래스(pseudo-class) 모디파이어인
last:를 사용하면 코드를 한결 간결하게 작성할 수 있습니다. 렌더링 성능과 가독성 측면에서도 CSS 기반 처리가 권장됩니다! ✨자세한 내용은 Tailwind CSS 공식 문서: Pseudo-classes를 참고해 보세요.
💡 제안하는 리팩토링 코드
📝 Committable suggestion
🤖 Prompt for AI Agents