github pmndrs/react-three-fiber v9.7.0

3 hours ago

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 dispose and onUpdate. 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: attach is 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 args updated), one could be ignore if the other bailed out of updates because of a React.memo or 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 list react-dom does.
  • 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

New Contributors

Full Changelog: v9.6.1...v9.7.0

Don't miss a new react-three-fiber release

NewReleases is sending notifications on new releases.