[FIX] 오늘/집중 탭 변경 후 통계 캐시 갱신#266
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough투두 생성·완료와 포커스 타이머 변경 성공 흐름에서 통계 쿼리 캐시 무효화를 추가했습니다. 기존 오늘 화면, 타이머, 투두 관련 캐시 무효화와 오류 처리는 유지됩니다. Changes통계 캐시 갱신
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In
`@apps/timo-web/app/`[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts:
- Line 154: Update the stopTimer mutation’s onSuccess handler in
useTodayTodoList so it immediately calls invalidateStatistics() after the timer
stops successfully, while retaining the existing call in
changeTodoStatus.onSuccess to reflect later todo-status updates as well.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 82149243-7982-40f0-b77b-d14b9df240ed
📒 Files selected for processing (3)
apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/todo-modal/use-create-todo-submit.tsapps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.tsapps/timo-web/app/[locale]/(main)/focus/_hooks/use-focus-session.ts
| invalidateTodayView(); | ||
| invalidateTodoDetail(todoId, dateKey); | ||
| invalidateFocusTodo(); | ||
| invalidateStatistics(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
타이머 중지 성공 직후에도 통계를 무효화해야 합니다.
현재 invalidateStatistics()가 changeTodoStatus.onSuccess 내부에만 있어, stopTimer는 성공했지만 후속 투두 완료 상태 변경이 실패하면 통계 캐시가 갱신되지 않습니다. stopTimer.onSuccess에서 즉시 한 번 호출하고, 투두 상태 변경 성공 후에도 현재 호출을 유지해 두 mutation의 성공 결과를 모두 반영하세요.
포커스 훅의 stopTimer 성공 처리처럼 타이머 mutation 성공 지점에 직접 배치하는 방식이 안전합니다. TanStack Query도 mutation 성공 시 관련 query를 invalidate하는 패턴을 안내합니다. (tanstack.com)
🤖 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
`@apps/timo-web/app/`[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts
at line 154, Update the stopTimer mutation’s onSuccess handler in
useTodayTodoList so it immediately calls invalidateStatistics() after the timer
stops successfully, while retaining the existing call in
changeTodoStatus.onSuccess to reflect later todo-status updates as well.
Timo Performance ReportBundle Size — timo-web
Lighthouse — timo-web
Image Optimization — timo-web
측정 커밋: |
ISSUE 🔗
close #265
What is this PR? 🔍
오늘 탭과 집중 탭에서 투두 상태 또는 타이머 상태가 변경된 뒤 통계 페이지의 캐시가 갱신되지 않던 문제를 수정했습니다.
To Reviewers
통계 값 자체는 프론트에서 계산하지 않고 서버 응답을 그대로 사용합니다.
이번 PR은 통계 계산 로직 변경이 아니라, 투두/타이머 변경 후 통계 관련 query가 stale 처리되도록 캐시 갱신 타이밍을 맞춘 작업입니다.
Screenshot 📷
Test Checklist ✔
pnpm lint:webpnpm check-types:web