global player pt. 9 fix play track
This commit is contained in:
@@ -531,6 +531,17 @@ export function insertTrack(track: Track, mode: InsertMode): void {
|
||||
// Normalize + basic guard
|
||||
if (!track || !Number.isFinite(track.id) || !track.src) return;
|
||||
|
||||
// If the user hits "Play" / "Play next" on the *currently playing* track,
|
||||
// treat it as a no-op. This avoids trying to move the current track to
|
||||
// "right after itself" and then skipping, which can produce confusing
|
||||
// queue changes (and in some cases corrupt traversal state).
|
||||
//
|
||||
// NOTE: "Add to queue" still dedupes below, but we early-return there too.
|
||||
if (currentIndex != null && queue[currentIndex]?.id === track.id) {
|
||||
queueNotify();
|
||||
return;
|
||||
}
|
||||
|
||||
// Empty queue behavior
|
||||
if (queue.length === 0) {
|
||||
queue = [track];
|
||||
|
||||
Reference in New Issue
Block a user