[Refactor/#302] 워크스페이스/설정/목록/타임라인 useCoreQuery, useCoreMutation 패턴 통일 - #303
Conversation
📝 WalkthroughWalkthrough워크스페이스와 타임라인 영역의 직접적인 React Query 사용을 Changes워크스페이스 서버 상태 관리
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
📚 Storybook 배포 완료
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/hooks/timeline/useUpdateTimeline.ts (1)
23-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value타임라인 상세 캐시 무효화를 위한 공통 쿼리 키 사용 권장
현재 타임라인 상세 쿼리 무효화를 위해 배열(
["timeline", "detail", orgId] as const)을 직접 하드코딩하고 있습니다. 일관된 키 관리를 위해src/lib/queryKeys.ts에 무효화 전용 키를 정의하여 사용하는 것을 권장합니다.♻️ 수정 제안
먼저
src/lib/queryKeys.ts파일에 무효화 전용 키를 추가합니다:timeline: { list: (orgId: number | null) => ["timeline", "list", orgId] as const, + /** 타임라인 상세 무효화 전용 키 */ + details: (orgId: number | null) => ["timeline", "detail", orgId] as const, detail: (orgId: number | null, timelineId: number | null) => ["timeline", "detail", orgId, timelineId] as const, },그리고 본 파일에서 해당 키를 사용하도록 변경합니다:
invalidateKeys: orgId != null ? [ QUERY_KEYS.timeline.list(orgId), - ["timeline", "detail", orgId] as const, + QUERY_KEYS.timeline.details(orgId), ] : [],🤖 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/hooks/timeline/useUpdateTimeline.ts` around lines 23 - 30, Replace the hardcoded ["timeline", "detail", orgId] invalidation key in useUpdateTimeline’s invalidateKeys with a shared timeline.details(orgId) key defined in queryKeys.ts. Add the dedicated details helper alongside timeline.list and timeline.detail, preserving the existing key shape and null handling.
🤖 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/hooks/timeline/useUpdateTimeline.ts`:
- Around line 23-30: Replace the hardcoded ["timeline", "detail", orgId]
invalidation key in useUpdateTimeline’s invalidateKeys with a shared
timeline.details(orgId) key defined in queryKeys.ts. Add the dedicated details
helper alongside timeline.list and timeline.detail, preserving the existing key
shape and null handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 62b12804-ae90-4b11-9d3f-e982f7dc63ec
📒 Files selected for processing (6)
src/components/workspace/InviteMemberModal.tsxsrc/hooks/timeline/useUpdateTimeline.tssrc/lib/queryKeys.tssrc/pages/workspace/MemberManagement.tsxsrc/pages/workspace/Workspace.tsxsrc/pages/workspace/WorkspaceSetting.tsx
🚨 관련 이슈
Closed #302
✨ 변경사항
✏️ 작업 내용
담당영역이었던 워크스페이스 목록/생성, 기본정보/설정, 멤버 관리, 초대 에서 raw
useQuery와useMutation을useCoreQuery와useCoreMutation으로 통일했습니다.mutation 성공 시 캐시 무효화는
invalidateKeys로 선언적 처리하고, toast/모달닫기와 같은 부수효과만userOnSuccess와userOnError에 남겼습니다.타임라인은 이미 Core 패턴 적용 상태라 raw 잔여 점검만 진행했습니다
캐시 반영
/workspace로 이동😅 미완성 작업
N/A
📢 논의 사항 및 참고 사항
Summary by CodeRabbit