fix(web): Next is off at the end of the queue with repeat one, since it only stops there (DRY W1)
release / web (push) Successful in 1m38s
release / go (push) Successful in 1m57s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 4m19s
release / android (push) Successful in 4m53s
release / Build signed APK (push) Successful in 5m18s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped

With repeat one on the last track, the play bar and Now Playing enabled
Next, but store.skipNext treats an explicit Next at the end the same for
repeat one as for repeat off: it pauses. The button now follows the store:
on when there is a track after this one or the queue wraps (repeat all).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 03:06:58 -05:00
co-authored by Claude Opus 5.5
parent 14afd86b8e
commit cceeaeb5c8
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -14,6 +14,9 @@ describe('transport rules', () => {
expect(canSkipNext({ index: 1, queue, repeat: 'off' })).toBe(true);
expect(canSkipNext({ index: 2, queue, repeat: 'off' })).toBe(false);
expect(canSkipNext({ index: 2, queue, repeat: 'all' })).toBe(true);
// Repeat one repeats a track as it ends; an explicit Next at the end of
// the queue stops, so the button is off as with repeat off.
expect(canSkipNext({ index: 2, queue, repeat: 'one' })).toBe(false);
});
test('repeat labels name each mode', () => {
+3 -2
View File
@@ -16,9 +16,10 @@ export function canSkipPrev(p: { index: number; position: number }): boolean {
}
/** Whether Next does anything: there is a track after this one, or the
queue wraps round. */
queue wraps round (repeat all). Repeat one doesn't count: an explicit
Next at the end stops there, as with repeat off (store.skipNext). */
export function canSkipNext(p: { index: number; queue: readonly unknown[]; repeat: RepeatMode }): boolean {
return !(p.index === p.queue.length - 1 && p.repeat === 'off');
return p.index + 1 < p.queue.length || p.repeat === 'all';
}
export function repeatLabel(mode: RepeatMode): string {