Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Movement between different #268

Open
weiblank opened this issue Feb 22, 2023 · 2 comments
Open

Movement between different #268

weiblank opened this issue Feb 22, 2023 · 2 comments

Comments

@weiblank
Copy link

When group A moves to group B, how do I determine the execution sequence of onRemove and onAdd

@vaynevayne
Copy link

vaynevayne commented Jun 2, 2023

+1, Multiple setlists are required, and they are difficult to work with

const list1 = useMemo((=>rawList.filtter(o=> o.age>5),   [rawList]))
const list2 = useMemo((=>rawList.filtter(o=> o.age<5),   [rawList]))

const setList1 =>(val)=> setRawList(...doSomeThing)
const setList2 => val=> setRawList(...doSomeThing)

<ReactSortable list={list1} setList={setList1} group='group'/>
<ReactSortable list={list2} setList={setList2} group='group'/>

above code is not work

@makis-x
Copy link

makis-x commented Aug 22, 2023

This works really well actually. You just need to compare the new list length vs the state list to see if something was removed or added. I used lodash differenceBy to get what was added and removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants