Closed ksnyder9801 closed 3 years ago
Fixes #319
There are some really surprising interactions between D3 and useCallback here as a result of the functional component rewrite. https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback vs. https://github.com/d3/d3-drag/blob/v2.0.0/README.md#drag_on "Changes to registered listeners via drag.on during a drag gesture do not affect the current drag gesture"
The useRef approach here is "not recommended", but it's not clear to me if the recommended approach (useReducer at a much higher level) would be performant (in terms of re-renders) or even feasible without a massive rewrite.
Fixes #319
There are some really surprising interactions between D3 and useCallback here as a result of the functional component rewrite. https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback vs. https://github.com/d3/d3-drag/blob/v2.0.0/README.md#drag_on "Changes to registered listeners via drag.on during a drag gesture do not affect the current drag gesture"
The useRef approach here is "not recommended", but it's not clear to me if the recommended approach (useReducer at a much higher level) would be performant (in terms of re-renders) or even feasible without a massive rewrite.