Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/lib/src/classes/PlayState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,16 @@ export class PlayState {
}
});

// Preserve current track when clearing queue
// Preserve current track when clearing queue (manual clear only, not when playing new content)
let blockAutoPlay = false;
let blockTimeout: ReturnType<typeof setTimeout> | undefined;
const playActions = ["playbackControls/PLAY", "mix/PLAY_MIX", "playQueue/ADD_NOW", "playQueue/ADD_TRACK_LIST_TO_PLAY_QUEUE"] as const;
for (const action of playActions) {
redux.intercept(action, unloads, () => blockAutoPlay);
redux.intercept(action, unloads, (payload: { overwritePlayQueue?: boolean }) => {
// Allow if it's explicit new content (user playing something new)
if (payload?.overwritePlayQueue === true) return false;
return blockAutoPlay;
});
}

redux.intercept("playQueue/CLEAR_QUEUE", unloads, () => {
Expand Down