Skip to content

v3.2.5 — WebView getBoundingClientRect null 报错修复

Choose a tag to compare

@cpufreestyle cpufreestyle released this 28 Jul 14:51
· 8 commits to main since this release

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.jsvendor/OrbitControls.js)本身已带守护,但旧版无守护导致报错。

改动文件

  • index.htmlmain.js 缓存破版字符串 ?v=3.2.2?v=3.2.4,强制 WebView 重新拉取最新模块。
  • main.jsOrbitControls 的 import 加 ?v=3.2.4 破版字符串;两处顶层 renderer.domElement.addEventListener 改为可选链 renderer?.domElement?.addEventListener 防御性守护。
  • package.json / package-lock.json:版本号同步至 3.2.4(与已发布 tag 一致)。

验证建议

在 WebView 中硬刷新(或重启预览)后,错误应不再出现。