The headline updates for this release are the reconciler fixes. We did a pass to harden what is there against react-dom as the standard.
- R3F's internal children were not being reordered correctly. Basically, if React reordered children, our internal map would drift out of sync and this would cause subtle bugs. This is now fixed. Thanks to @kvvasuu who reported it and @wanxiankai who offered a solution.
- Pierced props now reset properly. We had a bug where if a pierce prop was unset, the reconciler would try to reset it to a default value. However, it would set it to the base object instead of the pierced prop. This is fixed now.
// Initial render
<mesh position-x={5} />
// Later render: prop removed
<mesh />
// bug: would set it to the base object
mesh.x = 0 // !!! - Host props now update properly. Host props are ones that we supply such as
disposeandonUpdate. These now update properly. This also caused a subtle bug where imperatively updated values could get overwritten unexpectedly after unsetting the value in React. This is all fixed. Note:attachis fixed on first set and ignored if you try to dynamically update it. - Properly batch instance reconstruction. This one is pretty technical and if you are curious check out the test in the attached PR. Basically, there was an edge case where if two instances needed to reconstruct (because the
argsupdated), one could be ignore if the other bailed out of updates because of aReact.memoor similar. It is likely a problem you never had, but your agent would curse if you did. - Event priorities match
react-dom. React allows for prioritizing events, for example continuous events like wheel get a higher priority over impulse events like pointer. We copy from the best here and use the same listreact-domdoes. - Support reconciler microtasks. The React reconciler has a cool feature where it can queue microtasks to defer work based on the priorities we set earlier.
What's Changed
- chore: move eslint rules from parserOptions to top-level rules (#3706) by @in-ch in #3707
- docs: update
useFramehook description to specify that the clock delta is in seconds by @AJamesPhillips in #3742 - chore(CI): update test workflow actions to remove Node 20 deprecation warning by @Shushovan015 in #3710
- docs: fix FBXLoader naming in loading-models by @pavan-sh in #3745
- chore(docs): pmndrs/examples by @abernier in #3639
- fix: act import by @krispya in #3807
- fix: internal instance children synchronization after keyed reorder by @krispya in #3808
- chore: remove CodeSandbox CI by @krispya in #3809
- fix: Pierced prop reset by @krispya in #3810
- fix: Internal instance props sync by @krispya in #3811
- fix: Batch instance reconstruction hardening by @krispya in #3812
- feat: Match react-dom event priorities by @krispya in #3815
- feat: Support reconciler microtasks by @krispya in #3816
New Contributors
- @in-ch made their first contribution in #3707
- @AJamesPhillips made their first contribution in #3742
- @Shushovan015 made their first contribution in #3710
- @pavan-sh made their first contribution in #3745
Full Changelog: v9.6.1...v9.7.0