diff --git a/apps/storefront/src/components/pages/product/review/ProductReview.tsx b/apps/storefront/src/components/pages/product/review/ProductReview.tsx index 54caf54..daf6625 100644 --- a/apps/storefront/src/components/pages/product/review/ProductReview.tsx +++ b/apps/storefront/src/components/pages/product/review/ProductReview.tsx @@ -15,6 +15,7 @@ import { ProductReview as IProductReview, ReviewSummaryResponse, useAllReviewsQuery, + useMeQuery, useReviewByUserAndProductQuery, useReviewSummaryQuery, useReviewsQuery, @@ -232,10 +233,12 @@ interface ReviewFormProps extends ButtonProps { export const CreateReviewButton = ({ productId, ...rest }: ReviewFormProps) => { const modalRef: any = useRef(); + const { data: user, loading: userLoading, error: userError } = useMeQuery(); const { data, loading, error } = useReviewByUserAndProductQuery({ variables: { productId, }, + skip: !user?.me?.id, }); const closeModal = () => { @@ -244,7 +247,7 @@ export const CreateReviewButton = ({ productId, ...rest }: ReviewFormProps) => { } }; - if (loading) { + if (loading || userLoading) { return (