Skip to content

Fix lyrics view event handling and stale closure in AMLL player - #4

Merged
ingoau merged 1 commit into
mainfrom
claude/jolly-feynman-1fmkmq
Sep 24, 2026
Merged

ingoau merged 1 commit into
mainfrom
claude/jolly-feynman-1fmkmq

Conversation

@ingoau

@ingoau ingoau commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Summary

Fixed event handling and closure issues in the LyricsView component when interacting with the AMLL (Apple Music Lyrics Library) player for synced lyrics.

Key Changes

  • Added mappedRef to capture the current mapped state, preventing stale closures in the event handler
  • Changed event listener from "click" to "line-click" to properly handle AMLL's custom line click events
  • Updated the onClick handler to use mappedRef.current instead of the stale mapped variable, ensuring correct line data and offset calculations

Implementation Details

The AMLL player re-dispatches DOM clicks on a line as custom "line-click" events rather than standard "click" events. The previous implementation was listening to the wrong event type and using a stale reference to the mapped object, which could cause incorrect seek positions or missed interactions. By introducing a ref to track the current mapped state and listening to the correct event, the seek functionality now works reliably with synced lyrics.

https://claude.ai/code/session_01H4jKYEZBrEoNGrrM1hMVkF

AMLL 0.5 re-dispatches line clicks as "line-click", so the "click"
listener never fired. Also read the mapped lines through a ref so a
click after a track change seeks within the current track's lyrics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4jKYEZBrEoNGrrM1hMVkF
@ingoau
ingoau merged commit a3b04bb into main Sep 24, 2026
2 of 4 checks passed
@ingoau
ingoau deleted the claude/jolly-feynman-1fmkmq branch September 24, 2026 13:36
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