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

Order of state updates. #1596

Closed
TomaszSz368 opened this issue Jan 30, 2025 · 1 comment
Closed

Order of state updates. #1596

TomaszSz368 opened this issue Jan 30, 2025 · 1 comment

Comments

@TomaszSz368
Copy link

TomaszSz368 commented Jan 30, 2025

Unfortunatelly I cannot provide repoducable demo. If I will find issue cause I will try to update it immediately.

Overall issue works like this:
In some cases node is removed from draggable nodes before call of reducer

draggableNodes.delete(id);

This cause that in this line, node is removed from store nodes map before we set activeId:

const activeNode = useCachedNode(draggableNodes, activeId);

And lead to undefined in .get(id):

const draggableNode = id != null ? draggableNodes.get(id) : undefined;

I believe this is related to overall performance of application which is used. Standalone @dnd-kit component created by me eg in storybook works fine but inside production application it start to behave like this. That's why I cannot reproduce it.

@TomaszSz368
Copy link
Author

Found solution for problem. Instead of removing element on drag from tree I make it opacity 0 so it visually disappear but is not unmounted.

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

1 participant