Skip to content

降低首屏资源传输并按需启动卡片预览 - #66

Merged
Xiiiing merged 1 commit into
mainfrom
codex/library-first-load
Nov 6, 2026
Merged

Xiiiing merged 1 commit into
mainfrom
codex/library-first-load

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Nov 6, 2026

Copy link
Copy Markdown
Owner

资源库打开时先展示封面。紧凑卡片通过「启动预览」按需加载 iframe,支持鼠标、键盘、触屏和失败重试。已进入的预览保留键盘焦点,离开视口且不再持有焦点时回收。八张较重的封面提供 480 / 960 像素 WebP 和明暗版本,保留 PNG 回退。

本地生产构建,gzip,每组冷启动 3 次取中位数。桌面 1440 × 1000。手机 390 × 844,约 1.6 Mbps、120 ms 延迟、4 倍 CPU 降速。传输量统计用户启动预览前的窗口。

场景 首屏传输量 自动启动预览 用户启动到就绪
桌面 1,170 → 600 KB(−48.7%) 5 → 0 0.84 秒
慢网手机 593 → 314 KB(−47.0%) 1 → 0 1.87 秒

慢网手机首张封面 2.79 → 2.58 秒。桌面样本为 0.19 → 0.21 秒。两条分支组合构建的主文档脚本为 189,975 字节 gzip,低于 190,000 字节预算。

npm run check(22 项单测)、最终生产构建和 npm run test:dev 通过。全量 Playwright 204 项通过,另两项更新启动方式或等待布局稳定后通过复测。最终产物额外通过 7 项触屏、封面、预算与跨浏览器流程用例。

Closes #63

@Xiiiing
Xiiiing merged commit ac7ba33 into main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

降低资源库首屏传输量与实时预览启动成本

1 participant