Skip to content

fix(react-chess-game): address audio system review findings#84

Merged
dancamma merged 1 commit into
mainfrom
fix/audio-system-review-followups
Jul 11, 2026
Merged

fix(react-chess-game): address audio system review findings#84
dancamma merged 1 commit into
mainfrom
fix/audio-system-review-followups

Conversation

@dancamma

Copy link
Copy Markdown
Owner

Summary

Follow-ups from the post-merge review of #81:

  • Bundled sounds were broken for consumers (blocker): the tsup file loader emitted page-relative paths like ./capture-XXXX.ogg in the published JS, which resolve against the consumer's page URL and 404 silently, so default sounds never played outside this repo's Storybook. Switched to the dataurl loader: assets are inlined as base64 data URIs (~30KB total), matching the pre-feat(react-chess-game): introduce typed game events and AudioManager for sound system #81 inline approach.
  • Spurious illegal-move events: restored the isLegalMove guard in the Board click handler, so clicking an unreachable square to deselect a piece no longer goes through makeMove and no longer emits an illegal-move event on the new gameEvent stream.
  • Stale event replay: useBoardSounds now tracks the last handled event id, so mounting ChessGame.Sounds mid-game (e.g. a sound on/off toggle) doesn't replay the latest move's sound.

Test plan

  • New test: mounting Sounds with a pre-existing game event doesn't play it, later events do
  • New tests: click-deselection emits no game event, a legal click move emits move-made
  • Full suite (728 tests), lint, type check, and build pass
  • Verified dist/index.js inlines audio as data:application/ogg;base64,... with no loose .ogg files

🤖 Generated with Claude Code

- bundle .ogg assets as data URIs (tsup dataurl loader): the file loader
  emitted page-relative paths that 404 in consumer apps, silently
  breaking all default sounds
- restore isLegalMove guard in Board click handler so deselecting a
  piece no longer emits an illegal-move game event
- track last handled event id in useBoardSounds so mounting Sounds
  mid-game doesn't replay the latest event

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

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6517b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@react-chess-tools/react-chess-game Patch

Not sure what this means? Click here to learn what changesets are.

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

@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:30pm

@dancamma
dancamma merged commit 5db15e8 into main Jul 11, 2026
3 checks passed
@dancamma
dancamma deleted the fix/audio-system-review-followups 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.

1 participant