fix(web): keep user-opened scene when startup template is still loading
Some checks are pending
M6 deployable RC / quick (push) Waiting to run
M6 deployable RC / chromium (push) Blocked by required conditions
M6 deployable RC / release (push) Blocked by required conditions

Cancel the automatic startup General project as soon as a file is selected
or the lesson studio is requested, and re-check after the template fetch.
Prevents a slow remote first load from overwriting the user's scene.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-12 22:58:04 +08:00
parent c92cd933c5
commit a27aa46d7c
2 changed files with 16 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ HQ 2048(10.8 MB 库,67,633,152 bytes 解码);`check-re-pbr-limits.mjs`
| 部署工具 | `current/tools/web/deployment-http-server.mjs` + 8 个本地依赖模块(闭包 9 个),`current/docs/web/deployment-contract.json` |
| 静态产物 | `web/dist`(599MB;`assets/web_engine-*.wasm` 在服务器以符号链接指向 `vendor/blender/web_engine.wasm`,避免重复占盘) |
| wasm 传输 | nginx 58014 server 块启用 gzip(`application/wasm`);实测 241,949,523 → 79,395,379 bytes |
| 首次初始化 | 154 秒(gzip wasm 单次下载;`init` 超时已从 30 秒提高到 300 秒) |
| 首次初始化 | 154–193 秒(两次实测;gzip wasm 单次下载;`init` 超时已从 30 秒提高到 300 秒) |
| 部署证据 | `/home/mes123456/workinf_Blender_Wasm/tests/golden/RE-PBR-RENDER-001/deployed-app.png` |
部署期间修复的发布问题:
@@ -122,6 +122,9 @@ HQ 2048(10.8 MB 库,67,633,152 bytes 解码);`check-re-pbr-limits.mjs`
`init` 超时改为 300 秒。
3. 241MB wasm 直接传输在服务器上行带宽下超过 300 秒;已在 nginx 58014 server 块启用 gzip
(仅 `application/wasm` 等文本类型,视频不压缩),压缩后 79.4MB。
4. 慢速首载时,启动自动新建 General 工程的模板下载会在用户打开 studio 之后应用,覆盖用户场景
(实测 studio 已 6 对象,几秒后又回到 General 3 对象)。已在文件选择/教案载入时设置
`startupTemplateCancelled`,并在 `newProject(true)` 的模板下载后再次检查;用户打开优先于启动模板。
## 验证结果
@@ -139,8 +142,9 @@ HQ 2048(10.8 MB 库,67,633,152 bytes 解码);`check-re-pbr-limits.mjs`
| 生产构建 | `npm run build` PASS(typecheck + vite build;`web/dist` 含视频、字幕、poster、13 张章节截图、新 wasm) |
| 教案页面冒烟(生产 dist + 部署服务) | 56 张图片全部解码、视频 667.04 s、VTT 13 cues、无 4xx |
| 视频音频 | AAC 单声道 48 kHz;`volumedetect` mean −23.4 dB、max −2.6 dB(非静音) |
| 线上首次加载 | `init` 154 s;wasm 仅 1 次 200(`Content-Encoding: gzip`,79.4MB);无 pageerror/console error |
| 线上场景流程 | 启动 General 3 对象 → studio 6 对象 → `猴头.glb` 7 对象(`Engine: GLB imported r2`) |
| 线上首次加载 | `init` 192.8 s(范围 154–193 s);wasm 仅 1 次 200(`Content-Encoding: gzip`,79.4MB);无 pageerror/console error |
| 线上启动竞态 | init 完成后**立即**打开 studio,6 对象保持 10 秒以上不被启动 General 覆盖;8 秒内进入 `Engine: SceneIR r1 (6 objects)` |
| 线上场景流程 | studio 6 对象 → `猴头.glb` 7 对象(`Engine: GLB imported r2`,Suzanne 1225 顶点/969 面) |
| 线上 PBR 渲染 | 512×512,`data-texture-status=ready:1:0:`,产物写入 OPFS(截图见 `deployed-app.png`) |
| 线上教案 | 56 张图片全部解码、视频 `duration=667.04`、VTT 200 + 13 cues、0 个 4xx |