我们发布了一组新的错误修复,部分内容已向后移植自 v10 版本。以下是本次更新的亮点:
-
- 修复了 Portal 内存泄漏问题。即使 Portal 已被卸载,其根状态仍会被父组件持有,导致无法进行垃圾回收。在较为复杂的应用中频繁挂载与卸载时,该问题会迅速累积。现在,Portal 在卸载时能够正确释放资源。 - 自动更新像素比例。在切换显示器或进行缩放操作时,像素比例会自动调整。注意:每当
Canvas重新渲染时,setDpr方法都会被dpr属性覆盖。若需使用setDpr,请避免同时使用dpr属性。该行为将在 v10 版本中发生变化。 - 修复了 TypeScript JSX 类型定义。防止React.ElementType类型的属性意外坍缩为never。现在导入 R3F 不会再影响其他无关的 React 类型。 - 对象参数变更时拖拽保持响应。当对象的args属性发生变化时,拖拽交互将保持激活状态。 - 按需渲染模式下移除对象即时消失。启用frameloop="demand"时,被移除的对象会立即消失,而不会作为残留项滞留。
- 修复了 Portal 内存泄漏问题。即使 Portal 已被卸载,其根状态仍会被父组件持有,导致无法进行垃圾回收。在较为复杂的应用中频繁挂载与卸载时,该问题会迅速累积。现在,Portal 在卸载时能够正确释放资源。 - 自动更新像素比例。在切换显示器或进行缩放操作时,像素比例会自动调整。注意:每当
-
更新内容 - ci(docs):在 /next 路径下发布 v10 测试版文档,并添加版本切换器(由 @DennisSmolek 提交至 Pull Request #3971) - ci:从 master 分支移除 canary 工作流(canary 仅适用于 v10)(由 @DennisSmolek 提交至 Pull Request #3986) - fix(events):在实例重建期间保持指针捕获状态(由 @DennisSmolek 提交至 Pull Request #3985) - docs:在 hooks 示例中改用 Three.js addons loader 导入方式(由 @pavan-sh 提交至 Pull Request #3746) - docs:将 sparkjs、threepipe、react-three-map、wawa-vfx、r3f-globe、Three-VFX 加入社区组件网格(由 @jo-chemla 提交至 Pull Request #3714) - fix(docs):移除过时的 koestlich README 链接(由 @alex-marinov 提交至 Pull Request #3767) - docs(tutorials):在《加载模型》指南中添加 STL 文件加载说明(由 @BenMalaga 提交至 Pull Request #3787) - fix(core):当使用 frameloop="demand" 移除对象时请求渲染帧(由 @xaviergonz 提交至 Pull Request #3976) - fix(types):仅将 Three.js 构造函数注册为原生元素(由 @DennisSmolek 提交至 Pull Request #4002) - fix(core):跟随 devicePixelRatio 的变化(由 @tonyblu331 提交至 Pull Request #3959) - docs:添加 Codesandbox 预览图片(由 @abernier 提交至 Pull Request #4004) - refactor(fiber):明确 v9 核心领域的边界(由 @krispya 提交至 Pull Request #4008) - docs:使用 @pmndrs/docs 4 内置的版本切换器(由 @abernier 提交至 Pull Request #4005) - docs:采用 @pmndrs/docs 4.20 默认的 pmndrs 配色方案(由 @abernier 提交至 Pull Request #4011) - chore:添加 Pull Request 模板(由 @DennisSmolek 提交至 Pull Request #4019) - docs:修复测试与基础动画页面中的两个失效链接(由 @SatvikMishra08 提交至 Pull Request #4024) - fix(fiber):移植 v10 中的 Portal 内存泄漏修复方案(由 @wrangelvid 提交至 Pull Request #4030)
-
新增贡献者 - @alex-marinov 首次贡献于 Pull Request #3767 - @BenMalaga 首次贡献于 Pull Request #3787 - @xaviergonz 首次贡献于 Pull Request #3976 - @SatvikMishra08 首次贡献于 Pull Request #4024 - @wrangelvid 首次贡献于 Pull Request #4030
- 完整更新日志:https://github.com/pmndrs/react-three-fiber/compare/v9.8.1...v9.8.2
- Removed objects disappear immediately with
frameloop="demand"instead of lingering as ghosts.
What's Changed
- ci(docs): publish the v10 alpha docs under /next with a version switcher by @DennisSmolek in https://github.com/pmndrs/react-three-fiber/pull/3971
- ci: remove the canary workflow from master (canary is v10-only) by @DennisSmolek in https://github.com/pmndrs/react-three-fiber/pull/3986
- fix(events): keep pointer capture across instance reconstruction by @DennisSmolek in https://github.com/pmndrs/react-three-fiber/pull/3985
- docs: use three addons loader imports in hooks examples by @pavan-sh in https://github.com/pmndrs/react-three-fiber/pull/3746
- docs: add sparkjs, threepipe, react-three-map, wawa-vfx, r3f-globe, Three-VFX to community components grid by @jo-chemla in https://github.com/pmndrs/react-three-fiber/pull/3714
- fix(docs): remove outdated koestlich README link by @alex-marinov in https://github.com/pmndrs/react-three-fiber/pull/3767
- docs(tutorials): add STL loading to the Loading Models guide by @BenMalaga in https://github.com/pmndrs/react-three-fiber/pull/3787
- fix(core): request a frame when an object is removed with frameloop="demand" by @xaviergonz in https://github.com/pmndrs/react-three-fiber/pull/3976
- fix(types): only register three constructors as intrinsic elements by @DennisSmolek in https://github.com/pmndrs/react-three-fiber/pull/4002
- fix(core): follow devicePixelRatio changes by @tonyblu331 in https://github.com/pmndrs/react-three-fiber/pull/3959
- docs: add Codesandbox preview images by @abernier in https://github.com/pmndrs/react-three-fiber/pull/4004
- refactor(fiber): clarify v9 core domain boundaries by @krispya in https://github.com/pmndrs/react-three-fiber/pull/4008
- docs: use the built-in version switcher of @pmndrs/docs 4 by @abernier in https://github.com/pmndrs/react-three-fiber/pull/4005
- docs: adopt the default pmndrs palette of @pmndrs/docs 4.20 by @abernier in https://github.com/pmndrs/react-three-fiber/pull/4011
- chore: add a pull request template by @DennisSmolek in https://github.com/pmndrs/react-three-fiber/pull/4019
- docs: fix two dead links in testing and basic animations pages by @SatvikMishra08 in https://github.com/pmndrs/react-three-fiber/pull/4024
- fix(fiber): port the Portal leak fixes from v10 by @wrangelvid in https://github.com/pmndrs/react-three-fiber/pull/4030
New Contributors
- @alex-marinov made their first contribution in https://github.com/pmndrs/react-three-fiber/pull/3767
- @BenMalaga made their first contribution in https://github.com/pmndrs/react-three-fiber/pull/3787
- @xaviergonz made their first contribution in https://github.com/pmndrs/react-three-fiber/pull/3976
- @SatvikMishra08 made their first contribution in https://github.com/pmndrs/react-three-fiber/pull/4024
- @wrangelvid made their first contribution in https://github.com/pmndrs/react-three-fiber/pull/4030
Full Changelog: https://github.com/pmndrs/react-three-fiber/compare/v9.8.1...v9.8.2
