From c4b7cfaa2f011c7da41bce63c88c7a3df4ff9a99 Mon Sep 17 00:00:00 2001 From: saopig1 <4x7sw862st@gmail.com> Date: Wed, 6 May 2026 16:24:52 +0800 Subject: [PATCH] refactor(queue): add history field and pushHistory helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inert in this commit — no callers yet. Sets up the back-stack used by the upcoming history-aware prev rewrite. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/audio/queue.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/audio/queue.ts b/src/audio/queue.ts index f63980c..31b993a 100644 --- a/src/audio/queue.ts +++ b/src/audio/queue.ts @@ -21,6 +21,16 @@ export class PlayQueue { private currentIndex = -1; private mode: PlayMode = PlayMode.Sequential; private playedIndices = new Set(); + private history: number[] = []; + private static readonly HISTORY_LIMIT = 50; + + private pushHistory(idx: number): void { + if (idx < 0 || idx >= this.songs.length) return; + this.history.push(idx); + if (this.history.length > PlayQueue.HISTORY_LIMIT) { + this.history.shift(); + } + } add(song: QueuedSong): void { this.songs.push(song);