mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 19:51:12 -05:00
Implement cache invalidation improvements
This commit is contained in:
@@ -17,6 +17,8 @@ import { StarRating } from './StarRating';
|
||||
import { toDateOnly } from '@/lib/dateUtils';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { useQueryInvalidation } from '@/lib/queryInvalidation';
|
||||
|
||||
const reviewSchema = z.object({
|
||||
rating: z.number().min(0.5).max(5).multipleOf(0.5),
|
||||
title: z.string().optional(),
|
||||
@@ -41,6 +43,7 @@ export function ReviewForm({
|
||||
const {
|
||||
user
|
||||
} = useAuth();
|
||||
const { invalidateEntityReviews } = useQueryInvalidation();
|
||||
const [rating, setRating] = useState(0);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [photos, setPhotos] = useState<string[]>([]);
|
||||
@@ -118,6 +121,10 @@ export function ReviewForm({
|
||||
title: "Review Submitted!",
|
||||
description: "Thank you for your review. It will be published after moderation."
|
||||
});
|
||||
|
||||
// Invalidate review cache for instant UI update
|
||||
invalidateEntityReviews(entityType, entityId);
|
||||
|
||||
reset();
|
||||
setRating(0);
|
||||
setPhotos([]);
|
||||
|
||||
Reference in New Issue
Block a user