mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 14:11:18 -05:00
Reverted to commit 0091584677
This commit is contained in:
@@ -95,70 +95,6 @@ export function useQueryInvalidation() {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate user profile cache
|
||||
* Call this after profile updates
|
||||
*/
|
||||
invalidateUserProfile: (userId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.profile.detail(userId) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate profile stats cache
|
||||
* Call this after profile-related changes
|
||||
*/
|
||||
invalidateProfileStats: (userId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.profile.stats(userId) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate profile activity cache
|
||||
* Call this after activity changes
|
||||
*/
|
||||
invalidateProfileActivity: (userId: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['profile', 'activity', userId] });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate user search results
|
||||
* Call this when display names change
|
||||
*/
|
||||
invalidateUserSearch: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['users', 'search'] });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate admin settings cache
|
||||
* Call this after updating admin settings
|
||||
*/
|
||||
invalidateAdminSettings: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.admin.settings() });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate audit logs cache
|
||||
* Call this after inserting audit log entries
|
||||
*/
|
||||
invalidateAuditLogs: (userId?: string) => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.admin.auditLogs(userId) });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate contact submissions cache
|
||||
* Call this after updating contact submissions
|
||||
*/
|
||||
invalidateContactSubmissions: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-contact-submissions'] });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate blog posts cache
|
||||
* Call this after creating/updating/deleting blog posts
|
||||
*/
|
||||
invalidateBlogPosts: () => {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.admin.blogPosts() });
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate parks listing cache
|
||||
* Call this after creating/updating/deleting parks
|
||||
@@ -250,147 +186,5 @@ 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 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, limit?: number) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.rideModels.rides(modelId, limit),
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate entity name cache
|
||||
* Call this after updating an entity's name
|
||||
*/
|
||||
invalidateEntityName: (entityType: string, entityId: string) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.entities.name(entityType, entityId)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate blog post cache
|
||||
* Call this after updating a blog post
|
||||
*/
|
||||
invalidateBlogPost: (slug: string) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.blog.post(slug)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate coaster stats cache
|
||||
* Call this after updating ride statistics
|
||||
*/
|
||||
invalidateCoasterStats: (rideId: string) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.stats.coaster(rideId)
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate email change status cache
|
||||
* Call this after email change operations
|
||||
*/
|
||||
invalidateEmailChangeStatus: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.security.emailChangeStatus()
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate sessions cache
|
||||
* Call this after session operations (login, logout, revoke)
|
||||
*/
|
||||
invalidateSessions: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.security.sessions()
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Invalidate security queries
|
||||
* Call this after security-related changes (email, sessions)
|
||||
*/
|
||||
invalidateSecurityQueries: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.security.emailChangeStatus()
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.security.sessions()
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Smart invalidation for related entities
|
||||
* Invalidates entity detail, photos, reviews, and name cache
|
||||
* Call this after any entity update
|
||||
*/
|
||||
invalidateRelatedEntities: (entityType: string, entityId: string) => {
|
||||
// Invalidate the entity itself
|
||||
if (entityType === 'park') {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.parks.detail(entityId)
|
||||
});
|
||||
} else if (entityType === 'ride') {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.rides.detail('', entityId)
|
||||
});
|
||||
}
|
||||
|
||||
// Invalidate photos, reviews, and entity name
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.photos.entity(entityType, entityId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.reviews.entity(entityType as 'park' | 'ride', entityId)
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.entities.name(entityType, entityId)
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user