Why Does Dragging an Item in One Container Cause Re-Renders in Another? #1531
Unanswered
MaxVhanamane
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question:
I’m working with multiple containers (e.g., Container 1 and Container 2) using the dnd-kit library. I’ve noticed that when I drag an item in Container 1, the items in Container 2 re-render, even though both are wrapped in separate sortable contexts.
Here’s the issue:
I’m not interacting with Container 2 at all.
The items in Container 2 re-render even though I’m only dragging an item in Container 1.
I suspect this behavior is caused by Container 2's listener property being updated during the drag operation.
Questions:
Is this behavior expected or necessary for drag-and-drop functionality?
If not, how can I prevent Container 2 from re-rendering when I interact only with Container 1?
Could this be an issue with the useDraggable or useDroppable hooks, or something related to context updates?
I’d appreciate any insights or suggestions to reduce these unnecessary re-renders. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions