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

Dispatch state before drag starts is taking effect only when the mouse is released. #873

Open
diegoulloao opened this issue May 11, 2023 · 2 comments

Comments

@diegoulloao
Copy link

diegoulloao commented May 11, 2023

There is a prop updateBeforeSortStart that's useful for run asynchronous code before dragging. I need to call a setState before the drag starts, which changes some things on the list.

The issue:
For some reason the set state dispatcher is being called and I can see the new state value correctly in the console but it doesn't take effect in the ui until the dragged row (mouse) is released, so all changes are reflected after dragging.

How can I prevent this? I really need to see this state changes reflected in the ui before dragging starts.

This state that I need to dispatch is in charge of collapse some parents (tree list) before drag.

Is this an issue? What can I do?

@diegoulloao diegoulloao changed the title Dispatch state before drag starts is taking affect when releasing mouse. Dispatch state before drag starts is taking effect when only when releasing the mouse. May 12, 2023
@diegoulloao diegoulloao changed the title Dispatch state before drag starts is taking effect when only when releasing the mouse. Dispatch state before drag starts is taking effect only when releasing the mouse. May 12, 2023
@diegoulloao diegoulloao changed the title Dispatch state before drag starts is taking effect only when releasing the mouse. Dispatch state before drag starts is taking effect only when the mouse is released. May 12, 2023
@grayJellyFish
Copy link

this is happening for me too. seems like it might be due to automatic batching in react 18. Any pointers on what could be the fix here?

@diegoulloao
Copy link
Author

diegoulloao commented Sep 6, 2023

Finally we decided to move to react-dnd, it works pretty good.

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

2 participants