From a412baad53a34d8ebbd03d0b0cf055b1eae1736e Mon Sep 17 00:00:00 2001 From: dwindown Date: Fri, 26 Dec 2025 00:10:07 +0700 Subject: [PATCH] Add enhanced debugging for review API response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added console logging to track: - When fetchReviews is called - Raw API response data - Any errors from Supabase This will help debug why reviewer_name is not appearing in the API response. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/reviews/ProductReviews.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/reviews/ProductReviews.tsx b/src/components/reviews/ProductReviews.tsx index 1e37028..b32ffdd 100644 --- a/src/components/reviews/ProductReviews.tsx +++ b/src/components/reviews/ProductReviews.tsx @@ -28,6 +28,8 @@ export function ProductReviews({ productId, type }: ProductReviewsProps) { }, [productId, type]); const fetchReviews = async () => { + console.log('fetchReviews called - productId:', productId, 'type:', type); + let query = supabase .from('reviews') .select('id, rating, title, body, created_at, reviewer_name, profiles!user_id (name)') @@ -39,9 +41,10 @@ export function ProductReviews({ productId, type }: ProductReviewsProps) { query = query.eq('type', type); } - const { data } = await query.order('created_at', { ascending: false }).limit(3); + const { data, error } = await query.order('created_at', { ascending: false }).limit(3); console.log('Raw reviews data:', data); + console.log('Error:', error); if (data && data.length > 0) { const typedData = data as unknown as Review[];