Skip to content

fix: make loadTrack reconcile track metadata - #14

Closed
jeryj wants to merge 1 commit into
arraypress:mainfrom
jeryj:fix-load-track-artwork
Closed

fix: make loadTrack reconcile track metadata#14
jeryj wants to merge 1 commit into
arraypress:mainfrom
jeryj:fix-load-track-artwork

Conversation

@jeryj

@jeryj jeryj commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Make loadTrack() a complete in-place track swap for per-track metadata.

Previously, consumers could update the audio source with loadTrack(), but artist and artwork DOM could only be updated when the relevant elements already existed. If a new track added or removed artist/artwork metadata, consumers had to destroy and recreate the player to get the DOM into the right shape.

This updates loadTrack() to reconcile those fields in place:

  • add, update, or remove artist text
  • add, update, or remove artwork
  • update artwork alt text
  • keep artwork alt text in sync when artworkAlt is supplied

Why

This lets consumers switch tracks without tearing down the player instance when metadata presence changes, avoiding unnecessary DOM churn and visible layout shifts.

Testing

  • npm test
  • npm run build

Co-authored-by: Codex codex@openai.com

@jeryj
jeryj force-pushed the fix-load-track-artwork branch from 32bc2b9 to 4449fb5 Compare July 8, 2026 22:30
arraypress added a commit that referenced this pull request Jul 10, 2026
Ship the in-place artist/artwork reconciliation from #14.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@arraypress

Copy link
Copy Markdown
Owner

Thank you, @jeryj — this is really nicely done, and the test coverage in particular is much appreciated. 🙏

I applied it directly onto main (commit dd3ca86, rebuilt dist/ locally) and shipped it as v1.21.0 — it'll be on npm shortly. Closing this as applied-by-hand rather than via the merge button, but full credit is preserved in the commit's co-authorship. Thanks again for the contribution (and to Codex)!

@arraypress arraypress closed this Jul 10, 2026
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.

2 participants