Open IlyasArinov opened 4 years ago
It seems like its an issue with sortablejs, the options we give to the object at initialization are not being updated dynamically
For whoever stumbles upon this, here is the solution:
const key = useMemo(() => some uuid generator, [some props]);
<ReactSortable key={key} ....
I am having the same issue, the fix provided by @IlyasArinov works, but there should be a better way or a proper fix for this!
Hi! For some reason whenever I pass dynamic props that depend on state to ReactSortable component, the component options do not update.
Please check the sandbox: https://codesandbox.io/s/sortable-js-bug-4gpsd
As you can see initially ReactSortable gets passed IsDisabled = false, and then on first render it updates to true, but you can still sort.
Expected behavior For options to update according to props.
Versions: react-sortablejs = 6.0.0 react = 16.13.1
Please check the sandbox
https://codesandbox.io/s/sortable-js-bug-4gpsd