mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 09:11:13 -05:00
feat: Implement Phase 4 cleanup and polish
This commit is contained in:
@@ -186,5 +186,69 @@ export function useQueryInvalidation() {
|
||||
queryKey: ['homepage', 'featured-parks']
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate company detail cache
|
||||
* Call this after updating a company
|
||||
*/
|
||||
invalidateCompanyDetail: (slug: string, type: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.companies.detail(slug, type) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate company statistics cache
|
||||
* Call this after changes affecting company stats
|
||||
*/
|
||||
invalidateCompanyStatistics: (id: string, type: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.companies.statistics(id, type) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate company parks cache
|
||||
* Call this after park changes
|
||||
*/
|
||||
invalidateCompanyParks: (id: string, type: 'operator' | 'property_owner') => {
|
||||
queryClient.invalidateQueries({ queryKey: ['companies', 'parks', id, type] });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate profile activity cache
|
||||
* Call this after user activity changes
|
||||
*/
|
||||
invalidateProfileActivity: (userId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['profile', 'activity', userId] });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate profile stats cache
|
||||
* Call this after user stats changes
|
||||
*/
|
||||
invalidateProfileStats: (userId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.profile.stats(userId) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate ride model detail cache
|
||||
* Call this after updating a ride model
|
||||
*/
|
||||
invalidateRideModelDetail: (manufacturerSlug: string, modelSlug: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.rideModels.detail(manufacturerSlug, modelSlug) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate ride model statistics cache
|
||||
* Call this after changes affecting model stats
|
||||
*/
|
||||
invalidateRideModelStatistics: (modelId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.rideModels.statistics(modelId) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate model rides cache
|
||||
* Call this after ride changes
|
||||
*/
|
||||
invalidateModelRides: (modelId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['ride-models', 'rides', modelId] });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ export const queryKeys = {
|
||||
|
||||
// Photos queries
|
||||
photos: {
|
||||
entity: (entityType: string, entityId: string) =>
|
||||
['photos', entityType, entityId] as const,
|
||||
entity: (entityType: string, entityId: string, sortBy?: string) =>
|
||||
['photos', entityType, entityId, sortBy] as const,
|
||||
count: (entityType: string, entityId: string) =>
|
||||
['photos', 'count', entityType, entityId] as const,
|
||||
},
|
||||
@@ -77,4 +77,30 @@ export const queryKeys = {
|
||||
lists: {
|
||||
items: (listId: string) => ['list-items', listId] as const,
|
||||
},
|
||||
|
||||
// Company queries
|
||||
companies: {
|
||||
all: (type: string) => ['companies', 'all', type] as const,
|
||||
detail: (slug: string, type: string) => ['companies', 'detail', slug, type] as const,
|
||||
statistics: (id: string, type: string) => ['companies', 'statistics', id, type] as const,
|
||||
parks: (id: string, type: string, limit: number) => ['companies', 'parks', id, type, limit] as const,
|
||||
},
|
||||
|
||||
// Profile queries
|
||||
profile: {
|
||||
detail: (userId: string) => ['profile', userId] as const,
|
||||
activity: (userId: string, isOwn: boolean, isMod: boolean) =>
|
||||
['profile', 'activity', userId, isOwn, isMod] as const,
|
||||
stats: (userId: string) => ['profile', 'stats', userId] as const,
|
||||
},
|
||||
|
||||
// Ride Models queries
|
||||
rideModels: {
|
||||
all: (manufacturerId: string) => ['ride-models', 'all', manufacturerId] as const,
|
||||
detail: (manufacturerSlug: string, modelSlug: string) =>
|
||||
['ride-models', 'detail', manufacturerSlug, modelSlug] as const,
|
||||
rides: (modelId: string, limit?: number) =>
|
||||
['ride-models', 'rides', modelId, limit] as const,
|
||||
statistics: (modelId: string) => ['ride-models', 'statistics', modelId] as const,
|
||||
},
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user