Skip to content

Commit

Permalink
fix: loader problem when product has no reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobernardina committed Jun 5, 2024
1 parent 5002c23 commit a23edca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions verified-reviews/loaders/productReviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ export default async function productReviews(
return null;
}

const [reviewsResponse] = await client.reviews({
const reviewsResponse = await client.reviews({
productId: config.productId,
count: config?.count,
offset: config?.offset,
order: config?.order,
});

return reviewsResponse?.reviews?.map(toReview) ?? [];
const reviews = reviewsResponse?.[0];
return reviews?.reviews?.map(toReview) ?? [];
}

0 comments on commit a23edca

Please sign in to comment.