fix: load new content when the playlist prop changes - #40
Closed
jwbrandon wants to merge 1 commit into
Closed
Conversation
The config was generated once in the constructor, so a playlist change after mount never reached the player and it kept playing the old media. Consumers had to force a remount with a key prop. The playlist is now compared structurally on every update and handed to player.load(), reusing the player. A playlist that is empty or nullish is ignored, so content that resolves later does not blank out playback, and a change that lands while the library is still loading reaches setup(). Closes #20
Contributor
Author
|
Superseded by #41, which takes the same approach — structural comparison of the playlist, handed to The stronger parts of this PR were carried over to #41: the Closing in favour of #41. Thanks for the coverage — it made the surviving PR better. |
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.
This PR will...
Load the new content when the
playlistprop changes, instead of leaving the player on the old media. The playlist is compared structurally on each update and handed toplayer.load(), so the player is reused rather than remounted.Why is this Pull Request needed?
Fixes #20 — the config was built once in the constructor, so a
playlistchange after mount never reached the player. Consumers had to force a remount with akeyprop.Are there any points in the code the reviewer needs to double check?
shouldComponentUpdate, so a playlist that resolves while the library is still downloading reachessetup().playlistis applied after setup.file/sourceswould need a playlist-item key allowlist to reload without dropping siblings likeimageandtracks, which this package deliberately avoids; the README now documents them as setup-time only.shouldComponentUpdate, matching how event handlers are already handled there.componentDidUpdatewould miss updates where a handler and the playlist change together.Are there any Pull Requests open in other repos which need to be merged with this?
No.
Addresses Issue(s):
#20