feat(boot): 修启动白屏——静态启动屏 + 并行建目录 + 一次性维护挪到首屏后
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m24s

用户把资料目录放局域网:点开后先有 15s 纯白板,然后进度条 1s 闪过。
原因有两层:
1) app.js 顶部 `await IWBStorageFile.ready()` 在 React 首次渲染之前,存储装载多久白板就多久;
   而 index.html 里没有任何静态画面,WebView 只能显示空白。
2) 那段装载里有一串串行网络往返:串行建 9 个子目录、读 data.json、逐个读画布、
   再加 5 个一次性维护(migrateBlobs/backfillGalleryThumbs/stripInlineGalleryThumbs/
   rotateTrash/dropLegacyDisplayThumbs),局域网下每次往返几百毫秒就是十几秒。

- scripts/boot-splash.js(新增)+ scripts/build.js:index.html 内联静态启动屏
  (logo/标题/进度条/阶段文字/已等待秒数),不依赖脚本即可出画面;React 启动屏挂载时顶掉它
- src/storage-file.js:ensureDirs 改并发(9 次往返 → 1 次);一次性维护延后到首屏后 1.2s;
  prepare 阶段按 4 步上报(授权 / 建目录 / 整理文件名 / 完成)
- src/runtime-boot-progress.js:阶段权重改为 prepare 0-10 / data 10-16 / canvases 16-70 /
  library 70-80 / finalize 80-96,进度条从第一秒起覆盖整段装载
- scripts/check-dist.js:index.html script 数 3→4(含内联启动屏),并断言启动屏存在
- tests/boot-progress-test.js:同步新的阶段边界
This commit is contained in:
qiqi committed 2026-11-27 21:38:05 +08:00
1 parent e3c7a3ff9b
commit 81a30f261a
9 files changed
+141 -38

No files matched your search

+3 -3
View File
@@ -10,9 +10,9 @@
;(function (global) {
'use strict'
const PHASES = {
prepare: { from: 0, to: 6, label: '准备资料目录' },
data: { from: 6, to: 10, label: '读取 data.json' },
canvases: { from: 10, to: 70, label: '读取画布' },
prepare: { from: 0, to: 10, label: '准备资料目录' },
data: { from: 10, to: 16, label: '读取 data.json' },
canvases: { from: 16, to: 70, label: '读取画布' },
library: { from: 70, to: 80, label: '读取资源库' },
finalize: { from: 80, to: 96, label: '恢复会话' },
}