fix: Correct DOM element IDs for move history and captured pieces #5
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/dom-element-id-mismatches"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🐝 Hive Mind Bug Fix - Issues #2 and #3
Summary
Fixes DOM element ID mismatches preventing move history and captured pieces from displaying in the UI.
Issues Fixed
Changes Made
'move-list'to'move-history''white-captured'to'captured-white-pieces''black-captured'to'captured-black-pieces'Root Cause
JavaScript DOM queries were using incorrect element IDs that didn't match the actual IDs defined in
index.html. This causeddocument.getElementById()to returnnull, preventing UI updates.Testing
index.htmlelement IDsImpact
CI/CD
This PR will trigger the Gitea Actions CI pipeline (
.gitea/workflows/ci.yml):Manual Testing Checklist
After merge, verify:
Hive Mind Analysis
This fix was identified and implemented by the Hive Mind Collective Intelligence System with unanimous consensus (8/8 agents approved).
🤖 Generated with Claude Code
82479fb8c7tob44f071630Fixes critical bug where moves with captures would crash the game. Root Cause: - Board.movePiece() returns an object: { captured: pieceOrNull } - GameController.executeMove() was treating the return value as the piece itself - This caused move.captured to be { captured: piece } instead of piece - When GameState.recordMove() tried to access move.captured.color, it was undefined - Error: "TypeError: undefined is not an object (evaluating 'this.capturedPieces[move.captured.color].push')" The Fix: Extract the captured piece from the return object: const moveResult = this.board.movePiece(fromRow, fromCol, toRow, toCol); captured = moveResult.captured; This ensures move.captured is the actual Piece object (or null), not wrapped in an object. Impact: - Moves with captures now work correctly - Captured pieces are properly tracked in game state - UI can now display captured pieces - Game flow works end-to-end Testing: - All 124 unit tests passing ✅ - Captures properly recorded in capturedPieces arrays - No regression in non-capture moves 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>