fix: queue UI not refreshing after play next / add to queue (#103) - #116
Merged
Conversation
addToPlayNextInQueue and addToPlayingQueue mutated workingQueue/shuffledQueue in place, but those lists were the same reference held by PlayerUiState.queue. StateFlow's equality check returned true so no emission happened, and the queue stayed stale until an unrelated field (seek position) coincidentally ticked. Build a new list before assigning, swap the backing var, then publish.
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.
Fixes #103.
addToPlayNextInQueueandaddToPlayingQueuewere mutatingworkingQueue/shuffledQueuein place, and those lists were the same reference held byPlayerUiState.queue. StateFlow's equality check returned true, no emission happened, and the queue list stayed stale until an unrelated field (seek tick) coincidentally fired a recompose. The reporter's suggested.toList()patch didn't help because by the time it ran, the original list had already been mutated, so equality still held.Fix: build a new list before assigning, swap the backing var, then publish.
Verified on Pixel 7 Pro against both the legacy
QueueScreenand the newAnimatedPlayerSheetfrom #106. Nine consecutivePlay Nextcalls, recompose fires within ~15ms each time, no crashes.