Files
image-workbench-desktop/tests
qiqi 42c9df52da fix(canvas): 初始默认视口不再落盘(否则打开画布会跳过 doFit)
根因(iwb-picker 8 条超时的真因,实测确认):
useViewportPersistence 在首帧就把 useState 的初始视口 {x:40,y:30,scale:1} 写进
iwb_viewport / iwb_viewport_<ws>。之后打开画布时 loadWsInto 读到这份「已保存视口」,
就跳过了 doFit ⇒ 节点停在默认位置(实测 g1 在屏幕 x=120,被 318px 左停靠栏盖住),
点击落到浏览器插件的空状态层 .iwb-cwv-empty 上,Playwright 一直重试到 30s 超时。

修法:
- 首帧 effect 只标记 mounted,不落盘;只有发生真实视口变化(fit / 用户平移缩放)后才写
- flushViewport(beforeunload 兜底)同样要求「发生过真实变化」

验证:
- iwb-picker 9/9 全绿(此前 8 红)
- verify:ci 全绿(facts 数字已 sync)
- 已知红基线同步:33 → 25 条(picker 移出)
2026-11-27 06:28:20 +08:00
..