fix(ecommerce): corregir error de tipos en indice de tile promocional #42
@@ -144,8 +144,9 @@ export function CatalogClient({
|
||||
filtered.forEach((product, index) => {
|
||||
items.push({ type: "product", product });
|
||||
const isLast = index === filtered.length - 1;
|
||||
if (!isLast && (index + 1) % PROMO_TILE_INTERVAL === 0) {
|
||||
items.push({ type: "promo", category: promoRoots[promoIndex % promoRoots.length] });
|
||||
const promoCategory = promoRoots[promoIndex % promoRoots.length];
|
||||
if (!isLast && (index + 1) % PROMO_TILE_INTERVAL === 0 && promoCategory) {
|
||||
items.push({ type: "promo", category: promoCategory });
|
||||
promoIndex += 1;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user