SortableJS / react-sortablejs

React bindings for SortableJS
http://sortablejs.github.io/react-sortablejs/
MIT License
1.98k stars 206 forks source link

[bug] Sort property does not work properly #264

Open Veragin opened 1 year ago

Veragin commented 1 year ago

Describe the bug Changing sort property does not update functionality (sort is applied only onMount)

To Reproduce `<ReactSortable list={sort} setList={setList} sort={isSorting}

`

Steps to reproduce the behavior:

  1. Create a button that can change state isSorting, and render this ReactSortable next to it
  2. By clicking on the button you are not changing functionality

Expected behavior that it will work

Information After looking into your code you are creating Sortable object after onmount => but not updating i think you should be able to update Sortable object by option(name:String[, value:*]) method

Versions - Look in your package.json for this information: react-sortable = 6.1.4 react = 18

Veragin commented 1 year ago

I created a pull request solving this problem

Veragin commented 1 year ago

And guys you should definitely commit your yarn.lock => now I cant even build it ... i had to upgrade @parcel library