Skip to content

Commit

Permalink
Fix leak
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgr committed Feb 13, 2025
1 parent 6aff05c commit a4f8ef9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
26 changes: 14 additions & 12 deletions linx/loaders/product/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ const loader = async (

const products = response?.Model?.Grid?.Products ?? [];

return await Promise.all(
products.map(async (product) =>
await addAuctions(
toProduct(product, product.ProductSelection?.SkuID, {
cdn,
url,
currency: "BRL",
}),
ctx,
)
),
);
const transformedProducts = [];
for (const product of products) {
const transformedProduct = await addAuctions(
toProduct(product, product.ProductSelection?.SkuID, {
cdn,
url,
currency: "BRL",
}),
ctx,
);
transformedProducts.push(transformedProduct);
}

return transformedProducts;
};

export default loader;
24 changes: 12 additions & 12 deletions linx/loaders/product/listingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ const loader = async (
} = forProducts;
const { Model: { Grid: { Facets } } } = forProducts;

const products = await Promise.all(
Products.map(async (product) =>
await addAuctions(
toProduct(product, product.ProductSelection?.SkuID, {
cdn,
currency: "BRL",
url,
}),
ctx,
)
),
);
const products = [];
for (const product of Products) {
const transformedProduct = await addAuctions(
toProduct(product, product.ProductSelection?.SkuID, {
cdn,
currency: "BRL",
url,
}),
ctx,
);
products.push(transformedProduct);
}

return {
"@type": "ProductListingPage",
Expand Down

0 comments on commit a4f8ef9

Please sign in to comment.