Skip to content

perf(ratewise): 首頁換算器 CLS=0.237 超標(#441 改版引入,Lighthouse 門檻 ≤0.1) #454

Description

@s123104

摘要

RateWise 首頁 /(換算器)的 Cumulative Layout Shift 量測為 0.237,超過 Lighthouse CI 門檻 maxNumericValue ≤ 0.1,在 chore/ratewise-production-governance-v2 整合幹線的 PR 上穩定重現(連續 2 次 rerun 皆 0.237)。

背景 / 證據

影響

  • Lighthouse CI 在整合幹線 PR 上持續紅燈,遮蔽真實品質訊號、阻礙後續收斂 PR 綠燈合併。
  • 真實 UX:首頁載入時換算卡片/圖表跳動,行動裝置體感與 Core Web Vitals(CLS)受損,影響 SEO。

範圍

  • apps/ratewise/src/features/ratewise/components/SingleConverter.tsx(rate card / rate-basis pill / 圖表容器)
  • 首頁 sparkline 圖表元件與其載入態
  • apps/ratewise/src/index.css / singleConverterLayoutTokens 高度 token
  • 不涉及 /faq//about/(靜態頁)

建議方向(KISS)

  1. 為 async rate card / sparkline 圖表容器在 SSG 預留固定高度(min-h / aspect-ratio),避免資料載入後撐開。
  2. rate-basis pill 與 rate 副標使用骨架佔位或固定行高,rates 由 build-time → live 切換時不改變版面高度。
  3. 圖表以固定 chartHeight 佔位,載入完成再淡入,不改變容器高度。

驗收標準

  • Lighthouse CI 對 /cumulative-layout-shift ≤ 0.1(15 runs 穩定通過)。
  • 視覺驗證:首頁冷載入無可見換算卡片/圖表跳動(截圖前後對照)。
  • 不回退既有功能(rate-basis pill、計算機預覽、圖表 hover)。
  • pnpm --filter @app/ratewise typecheck 與相關 vitest 全綠。

關聯

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:p2Medium-priority work

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions