v3.2.5 — WebView getBoundingClientRect null 报错修复
v3.2.5 修复说明
修复内容
- 修复 WebView 预览(
http://localhost:3001/)偶发的Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')。 - 根因:
index.html引用的main.js缓存破版字符串停留在?v=3.2.2,WebView 复用了加入 null 守护之前的旧模块;getBoundingClientRect两处调用点(main.js、vendor/OrbitControls.js)本身已带守护,但旧版无守护导致报错。
改动文件
index.html:main.js缓存破版字符串?v=3.2.2→?v=3.2.4,强制 WebView 重新拉取最新模块。main.js:OrbitControls的 import 加?v=3.2.4破版字符串;两处顶层renderer.domElement.addEventListener改为可选链renderer?.domElement?.addEventListener防御性守护。package.json/package-lock.json:版本号同步至 3.2.4(与已发布 tag 一致)。
验证建议
在 WebView 中硬刷新(或重启预览)后,错误应不再出现。