From 125d24792e5d2e550633f05de2e04176d9624bc4 Mon Sep 17 00:00:00 2001 From: Leidison Siqueira Barbosa Date: Sun, 10 Jan 2021 20:33:09 -0300 Subject: [PATCH] Update index.tsx Improved logic readability --- pages/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index cd6513e3e..599dcfa2f 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -45,10 +45,9 @@ export async function getStaticProps({ const { featured, bestSelling } = (() => { // Create a copy of products that we can mutate const products = [...newestProducts] - .filter((product) => { - const featuredList = featuredProducts.map((product) => product.node.entityId) - return !featuredList.includes(product.node.entityId) - }) + .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 // 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