Skip to content

test(react-chess-puzzle): regression test for #82 (crash on puzzle prop change)#85

Merged
dancamma merged 1 commit into
mainfrom
test/issue-82-regression
Jul 11, 2026
Merged

test(react-chess-puzzle): regression test for #82 (crash on puzzle prop change)#85
dancamma merged 1 commit into
mainfrom
test/issue-82-regression

Conversation

@dancamma

@dancamma dancamma commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Context

Issue #82 reports an Invalid move: Rxd6+ crash when the puzzle prop of ChessPuzzle.Root changes after solving a puzzle (e.g. onSolve advancing to the next puzzle).

Diagnosis

The crash happened in getCurrentFen (packages/react-chess-game/src/utils/chess.ts): during the puzzle switch a render saw the new fen but the old puzzle's history, and replaying the moves inside the useMemo threw Invalid move.

The bug is already fixed on main by the "prop sync" rework (0c3df58), which was never released: the 1.0.x versions on npm don't include it. Verified empirically: this test fails on d21ecb8 (the code published as 1.0.x) with exactly the stack trace from the issue, and passes on main.

What this PR does

Adds only the regression test, faithful to the issue's repro: two puzzles cycled via onSolve (the first with makeFirstMove: true), solve the first one and assert the second loads cleanly and is solvable in turn.

No production code changes, so no changeset.

Closes #82

🤖 Generated with Claude Code

…crash

The crash from #82 ("Invalid move" thrown while replaying the previous
puzzle's history over the new fen in getCurrentFen) was fixed by the
prop-sync rework in 0c3df58 but never covered by a test. The test fails
on the released 1.0.x code and passes on main.

Closes #82

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-chess-tools Ready Ready Preview, Comment Jul 11, 2026 4:38pm

@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 52c0f2e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dancamma
dancamma merged commit 338bd31 into main Jul 11, 2026
3 checks passed
@dancamma
dancamma deleted the test/issue-82-regression branch July 11, 2026 16:52
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.

Error when updating puzzleProperty on ChessPuzzle.Root

1 participant