mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +00:00
Update index.tsx
The change prevents the duplication of products featured on the home page.
This commit is contained in:
parent
742ac5786e
commit
5a42125f7a
@ -45,6 +45,9 @@ export async function getStaticProps({
|
|||||||
const { featured, bestSelling } = (() => {
|
const { featured, bestSelling } = (() => {
|
||||||
// Create a copy of products that we can mutate
|
// Create a copy of products that we can mutate
|
||||||
const products = [...newestProducts]
|
const products = [...newestProducts]
|
||||||
|
.filter((product) => !featuredProducts
|
||||||
|
.map((product) => product.node.entityId)
|
||||||
|
.includes(product.node.entityId))
|
||||||
// If the lists of featured and best selling products don't have enough
|
// If the lists of featured and best selling products don't have enough
|
||||||
// products, then fill them with products from the products list, this
|
// products, then fill them with products from the products list, this
|
||||||
// is useful for new commerce sites that don't have a lot of products
|
// is useful for new commerce sites that don't have a lot of products
|
||||||
|
Loading…
x
Reference in New Issue
Block a user