Skip to content

fix: include promotion piece in onMove callback - #5

Merged
anas-asghar4831 merged 1 commit into
masterfrom
fix/onmove-promotion-field
Mar 25, 2026
Merged

anas-asghar4831 merged 1 commit into
masterfrom
fix/onmove-promotion-field

Conversation

@anas-asghar4831

Copy link
Copy Markdown
Owner

Summary

Closes #4 — reported by @zyaga in #2.

The onMove callback now includes an optional promotion field when a pawn promotes, enabling consumers to build UCI strings (e.g. e7e8q) and record proper notation.

Changes

  • src/types.ts: Added optional promotion?: PromotionPiece to the onMove payload type
  • src/board.tsx: Pass promotion piece through all 4 code paths:
    • autoPromoteTo path
    • onPromotion callback path
    • Built-in picker path
    • Premove execution path

Backwards Compatible

The promotion field is optional — existing onMove consumers are unaffected. Non-promotion moves continue to pass { from, to } with no promotion field.

@anas-asghar4831
anas-asghar4831 merged commit 9a6d288 into master Mar 25, 2026
1 check passed
@anas-asghar4831
anas-asghar4831 deleted the fix/onmove-promotion-field branch March 25, 2026 15:04
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

Successfully merging this pull request may close these issues.

onMove callback missing promotion piece info

1 participant