Fix race condition causing point re-selection after drag-and-drop#166
Fix race condition causing point re-selection after drag-and-drop#166
Conversation
Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com>
|
@copilot couldn't you use event.stopPropagation() instead |
The |
|
@copilot sounds like dragging is unreliable |
The The |
|
Dropping a piece onto a valid empty spot immediately re-selected that point due to both
onDropandonPointerUphandlers firing before React state updates propagated.Changes
dropOccurredRefto track drop events synchronously inPoint.tsxonDropto set flag, preventingonPointerUpfrom executing selection logicsetTimeout(..., 0)after event loop completesUses ref instead of state for immediate synchronous access, avoiding React's async update delay.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.