From e00ff8ceca3e95e5240abdf9b107f2493eb67e4a Mon Sep 17 00:00:00 2001 From: Lihan YANG Date: Mon, 1 Jun 2026 16:33:04 +0800 Subject: [PATCH] fix(pdf): avoid toReversed in icon size resolution (#3129) --- packages/pdf/src/templates/shared/icon-size.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/pdf/src/templates/shared/icon-size.ts b/packages/pdf/src/templates/shared/icon-size.ts index 8929934ff..16ab5a2cf 100644 --- a/packages/pdf/src/templates/shared/icon-size.ts +++ b/packages/pdf/src/templates/shared/icon-size.ts @@ -17,7 +17,12 @@ export const parseStyleFontSize = (fontSize: Style["fontSize"] | undefined): num export const resolveStyleFontSize = (...styles: StyleInput[]): number | undefined => { for (let index = styles.length - 1; index >= 0; index -= 1) { - for (const style of composeStyles(styles[index]).toReversed()) { + const composedStyles = composeStyles(styles[index]); + + for (let styleIndex = composedStyles.length - 1; styleIndex >= 0; styleIndex -= 1) { + const style = composedStyles[styleIndex]; + if (style === undefined) continue; + const fontSize = parseStyleFontSize(style.fontSize); if (fontSize !== undefined) return fontSize; }