perf(nextjs): evaluates slide element attributes in parallel

This commit is contained in:
sauravniraula 2025-07-21 00:36:24 +05:45
parent 05835cbd48
commit aaaf16543f
No known key found for this signature in database
GPG key ID: 60FCC1B5A5E83326

View file

@ -159,11 +159,9 @@ async function screenshotElement(element: ElementAttributes, screenshotsDir: str
async function getSlidesAttributes(slides: ElementHandle<Element>[], screenshotsDir: string): Promise<SlideAttributesResult[]> {
const slideAttributes = [];
for (const slide of slides) {
const attributes = await getAllChildElementsAttributes({ element: slide, screenshotsDir });
slideAttributes.push(attributes);
}
const slideAttributes = await Promise.all(
slides.map((slide) => getAllChildElementsAttributes({ element: slide, screenshotsDir }))
);
return slideAttributes;
}