Skip to content

fix: queue UI not refreshing after play next / add to queue (#103) - #116

Merged
joelkanyi merged 1 commit into
mainfrom
fix/queue-ui-play-next
Jun 8, 2026
Merged

fix: queue UI not refreshing after play next / add to queue (#103)#116
joelkanyi merged 1 commit into
mainfrom
fix/queue-ui-play-next

Conversation

@joelkanyi

Copy link
Copy Markdown
Collaborator

Fixes #103.

addToPlayNextInQueue and addToPlayingQueue were mutating workingQueue / shuffledQueue in place, and those lists were the same reference held by PlayerUiState.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 QueueScreen and the new AnimatedPlayerSheet from #106. Nine consecutive Play Next calls, recompose fires within ~15ms each time, no crashes.

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.
@joelkanyi
joelkanyi merged commit c373a8e into main Jun 8, 2026
1 check passed
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.

Queue UI doesn't refresh when adding track to Play Next while queue sheet is open

1 participant