drei
drei copied to clipboard
<Segment/> does not unmount.
-
three
version: 9.4.5 -
@react-three/fiber
version: 8.0.14 -
@react-three/drei
version: 9.11.0 -
node
version: 16.15.0 -
yarn
version: 1.22.19
Problem description:
<Segments>{cond && <Segment />}</Segments>
does not remove children.
Relevant code:
Play around with the count
slider and notice that lines don't disappear and are not spread evenly anymore.
https://codesandbox.io/s/segment-bug-jtxvp6?file=/src/App.js
I'm not sure this WASN'T happening before, but in any case you can solve it by keying the segments with the count
<Segments key={config.count}
So that the data is recreated when count changes - which should be the case. Ideally the count shouldn't change at runtime since it requires recreating the geometry in most use cases.