react-three-gui icon indicating copy to clipboard operation
react-three-gui copied to clipboard

onChange doesn't fire for spring controls

Open mattrossman opened this issue 4 years ago • 1 comments

To reproduce:

  • Open the example codesandbox and update to v0.4.2
  • Below line 41 add onChange: console.log

The value only gets logged on the initial renders, but changing the value does not cause new values to be printed. I would expect that as the value changes, the internal onChange handler from react-spring would fire.

Ultimately, the reason for #27 and now this issue is that I want to update a Three.js data structure in-place without triggering a bunch of re-renders for the component.

mattrossman avatar Nov 20 '20 19:11 mattrossman

There's something generally broken about the example. Changing the box position and subsequently changing the rotation causes the position to visually reset, even thought the position value hasn't changed in the panel.

When adding in the log statement from my previous comment, you'll also notice that when the component re-renders from a change in rotation it always logs the position as zero.

mattrossman avatar Nov 20 '20 19:11 mattrossman