Merged
Conversation
- Point.tsx: also handle valid drag-over detection in onDragOver (fires continuously), so the green highlight appears even when dragenter fires before React processes selected=-1 (polyfill batches dragstart+dragenter in same touchmove handler) - Piece.tsx: add onDragEnd for bar pieces to clear selection state after drag ends (successful or failed) - index.tsx: for bar piece drags (from===Color.White/Black) in online mode, fall back to fresh nextMoves(game,usedDice,-1) check when moves.has(to) is false due to stale React state from batching Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com>
Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix dragging off of the bar to hit functionality
fix: bar piece drag-to-hit not working
Mar 20, 2026
|
Per review feedback, those drag events should not be firing together. The real fixes are in Point.tsx (onDragOver visual) and Piece.tsx (onDragEnd cleanup). Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com> Agent-Logs-Url: https://github.com/ProLoser/PeaceInTheMiddleEast/sessions/2a6431c5-b101-41a7-ae82-febeea3c1db5
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dragging a piece off the bar to hit an opponent's blot had no visual feedback.
Root cause: The
drag-drop-touchpolyfill firesdragstartanddragentersynchronously within the sametouchmovehandler. React 18 batches thesetSelected(-1)update fromdragstart, sovalidis stillfalsewhendragenterfires — the green highlight never appears on valid re-entry points.Changes
Point.tsx—onDragOver(fires continuously) now mirrorsonDragEnter'svalid && !dragOverlogic. Once React flushes the batch andvalidbecomestrue, the nextdragovertriggers the highlight:Piece.tsx— AddedonDragEndfor bar pieces to clearselectedafter drag ends (previously leftselected=-1on failed drags).Original prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.