Repository navigation
Clear a queued song's row without taking the playlist's own - #344
Merged
crmne merged 1 commit intoSep 9, 2026
Merged
Conversation
Play next writes a queued song to two lists: `manual_queue`, saved with the session, and `pending_queue_adds`, which holds the same song for a moment so a late answer from Spotify cannot make the new row vanish. `clear_queue` in src/app.rs counted the two together, so one song queued once asked Next up for two rows. The `retain` below walks the whole list rather than only the rows on top, so the second row it took was the playlist's own copy of that song, further down. Queue a song that is already coming up later, change your mind, press the trash beside Playing next, and the playlist loses it too. Rule 7 in docs/_reference/queue.md says clear only removes your songs, and `the_queued_section_covers_only_the_users_own_rows` already says the context's own copy is not one of them. The two lists count the same wishes, so the rows to take back are as many as the longer of them holds. Neither list alone is the count: a pending add outlives its `manual_queue` entry once the song starts, and `manual_queue` drops its oldest entry past a hundred songs.
crmne
added a commit
that referenced
this pull request
Sep 9, 2026
Co-authored-by: Max Freedom Pollard <[email protected]>
9didhe
pushed a commit
to 9didhe/spotifast-prism
that referenced
this pull request
Nov 12, 2026
Co-authored-by: Max Freedom Pollard <[email protected]>
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.
Why
Play next puts a song at the top of Next up, and the trash beside that heading takes those rows back. Rule 7 in
docs/_reference/queue.mdsays it only removes your songs and the playlist's rows below stay. It takes one of those too when the song you queued is also coming up later in whatever is playing. Queue a song that sits further down the playlist, change your mind, press the trash, and the playlist loses its copy as well. The row is gone from the list until the next fetch of Spotify's queue brings it back, and on local playback the engine has already been told to drop what it held, so the song after this one is not the one the list promised.What changed
queue_onewrites a queued song to two lists.manual_queueis the session's record of what you asked for;pending_queue_addsholds the same song for a moment so a late or stale answer from Spotify cannot make the new row vanish before it is confirmed.clear_queueinsrc/app.rscounted the two together:One song queued once is one row in Next up, but it is in both lists, so
countssays two. Theretainunder it walks the whole queue rather than only the rows on top, so the second row it finds with that URI is the playlist's own, and that goes as well.The two lists count the same wishes, so the rows to take back are as many as the longer of them holds, not as many as both together. Neither list alone is the count either: a pending add outlives its
manual_queueentry once the queued song starts playing, andmanual_queuedrops its oldest entry past a hundred songs.clear_queuenow counts each list and keeps the larger count per song, and nothing else in it moves.clear_queue_takes_the_hand_queued_rows_and_keeps_the_contextsetsmanual_queueby hand, sopending_queue_addsis empty there and the old and new arithmetic agree. That is why it stayed green through this.the_queued_section_covers_only_the_users_own_rowsalready says the context's own copy of a queued song is not a queued row; clearing now agrees with it.Verification
clearing_a_just_queued_song_leaves_the_contexts_copy_of_itgoes through the actions rather than the fields: withspotify:track:balready among the context's upcoming rows,Action::AddToQueuefor b, thenAction::ClearQueue. It asserts the queue straight after the add too, so a change that stopped inserting the row could not make it pass by accident.On
mainit fails:macOS 26.2 on Apple silicon, toolchain 1.98.0 from
rust-toolchain.toml.cargo fmt --all --check,cargo clippy --locked --no-default-features --all-targets -- -D warnings,cargo test --locked --no-default-features --all-targets(350 passed, up from 349 by the new test),cargo test --locked --no-default-features --doc, andRUSTDOCFLAGS='-D warnings' cargo doc --locked --no-default-features --no-deps.--no-default-featuresthroughout because this machine has no libprojectM build for MilkDrop; nothing here touches that feature. Not run on Linux or Windows: the change isstdcollections with no platform-specific code.No user-visible setting, file, or network access changes, and the queue's documented rules are the ones this restores, so there is no documentation change.
CONTRIBUTING.mdand kept this pull request to one concern.