mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 21:31:14 -05:00
Apply all API enhancements
This commit is contained in:
@@ -17,6 +17,7 @@ import { PhotoModal } from '@/components/moderation/PhotoModal';
|
||||
import { EntityPhotoGalleryProps } from '@/types/submissions';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
import { useEntityPhotos } from '@/hooks/photos/useEntityPhotos';
|
||||
import { useQueryInvalidation } from '@/lib/queryInvalidation';
|
||||
|
||||
interface Photo {
|
||||
id: string;
|
||||
@@ -49,6 +50,13 @@ export function EntityPhotoGallery({
|
||||
sortBy
|
||||
);
|
||||
|
||||
// Query invalidation for cross-component cache updates
|
||||
const {
|
||||
invalidateEntityPhotos,
|
||||
invalidatePhotoCount,
|
||||
invalidateHomepageData
|
||||
} = useQueryInvalidation();
|
||||
|
||||
const handleUploadClick = () => {
|
||||
if (!user) {
|
||||
navigate('/auth');
|
||||
@@ -59,7 +67,14 @@ export function EntityPhotoGallery({
|
||||
|
||||
const handleSubmissionComplete = () => {
|
||||
setShowUpload(false);
|
||||
refetch(); // Refresh photos after submission
|
||||
|
||||
// Invalidate all related caches
|
||||
invalidateEntityPhotos(entityType, entityId);
|
||||
invalidatePhotoCount(entityType, entityId);
|
||||
invalidateHomepageData(); // Photos affect homepage stats
|
||||
|
||||
// Also refetch local component (immediate UI update)
|
||||
refetch();
|
||||
};
|
||||
|
||||
const handlePhotoClick = (index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user