Fix lyrics view event handling and stale closure in AMLL player - #4
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
mappedRefto capture the currentmappedstate, preventing stale closures in the event handler"click"to"line-click"to properly handle AMLL's custom line click eventsmappedRef.currentinstead of the stalemappedvariable, ensuring correct line data and offset calculationsImplementation 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 themappedobject, which could cause incorrect seek positions or missed interactions. By introducing a ref to track the currentmappedstate and listening to the correct event, the seek functionality now works reliably with synced lyrics.https://claude.ai/code/session_01H4jKYEZBrEoNGrrM1hMVkF