Skip to content

♻️ [Refactor] queryKey 상수 중앙화 #238

@Seojegyeong

Description

@Seojegyeong

🛠️ Issue Description

현재 queryKey 문자열 리터럴이 각 파일에 분산되어 관리되고 있습니다.
동일한 키("my-workspaces", "campaigns" 등)가 query 선언부와 invalidateQueries 호출부에 중복으로 작성되어 있어
오타 발생 시 런타임에서야 확인 가능하고 누락 파일이 생길 수 있습니다.
따라서 전체 queryKey를 상수로 중앙 관리할 예정입니다.

💭 Cause and effect

원인

  • "my-workspaces" 키가 MainLayout, WorkspaceSwitcher, Workspace, WorkspaceSetting 등 4개 파일에 문자열로 흩어져 있음
  • "campaigns" 키가 useCampaignGroup, AdsListPage 양쪽에 각각 작성되어 있음
  • TypeScript의 타입 체크가 문자열 리터럴 키 오타를 잡아주지 못함

예상 결과

  • 키 변경 시 queryKeys.ts 한 곳만 수정하면 전파됨
  • 오타를 타입 레벨에서 방지
  • 이후 useCoreQuery / useCoreMutation 마이그레이션 시 상수를 바로 재사용 가능

📝 check-lists

  • 파일 생성 및 전체 키 상수 정의
  • MainLayout, WorkspaceSwitcher, Workspace, WorkspaceSetting -> "my-workspaces" 키 상수로 교체
  • WorkspaceSwitcher -> "savedWorkspace" 키 상수로 교체
  • MemberManagement -> "workspaceMembers", "workspaceMemberCount", "workspacePendingMembers" 키 상수로 교체
  • useCampaignGroup, AdsListPage -> "campaigns" 키 상수로 교체
  • useAiAnalysisReport -> "ai", "report" 키 상수로 교체
  • 교체 후 queryKey 문자열 리터럴 직접 사용

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions