react-postprocessing
react-postprocessing copied to clipboard
perf(Select): fix update loop
See #236 for additional details
Would be great to hear your feedback on this. This code
const changed = (current.length !== api.selected.length) ? true : !current.every(o => api.selected.includes(o))
is only correct if there are no duplicates in any of the two arrays (otherwise, they would have to be de-duped first) - but I believe that is the case here.
Hmm after testing this further, I realized that this doesn't work in the case of
<Canvas>
<Selection>
<Select enabled>
<Box name="box" />
</Select>
<Select enabled={false}>
</Select>
</Selection>
</Canvas>
I will look into this some more...
I've played with this a bit more and I believe this fix is now working as intended.
is it ready to go in? did you notice any adverse effects on older boxes?