Standardize the TanStack Query setup across the client by properly organizing queries, mutations, types, and query key factories according to best practices.
🎯 Goals
- Separate queries from mutations into dedicated files
- Create proper TypeScript interfaces for all API requests/responses
- Implement query key factories for all features
- Ensure consistent file structure across all features
📝 Implementation Guidelines
Each feature's data/ folder should follow this structure:
feature/
└── data/
├── types.ts # Request/Response types
├── queries.ts # GET operations with hooks
├── mutations.ts # POST/PUT/PATCH/DELETE with hooks
└── queryKeys.ts # Query key factory
Query Key Factory Pattern
Reference the existing pattern in search/data/queries.ts
Types File Structure
// types.ts
export interface FeatureRequest {
// Request payload fields
}
export interface FeatureResponse {
// Response data fields
}
export interface FeatureListResponse {
// Array or paginated response
}
Definition of done:
Standardize the TanStack Query setup across the client by properly organizing queries, mutations, types, and query key factories according to best practices.
🎯 Goals
📝 Implementation Guidelines
Each feature's
data/folder should follow this structure:Query Key Factory Pattern
Reference the existing pattern in
search/data/queries.tsTypes File Structure
Definition of done: