fix(web): missing files show greyed in track lists and never enter the queue (#5418)
release / web (push) Failing after 1m23s
release / govulncheck (push) Successful in 25s
release / go (push) Successful in 1m35s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / integration (push) Canceled after 4m34s
release / android (push) Canceled after 4m39s
release / Build signed APK (releases and dev) (push) Canceled after 3m21s
release / web (push) Failing after 1m23s
release / govulncheck (push) Successful in 25s
release / go (push) Successful in 1m35s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / integration (push) Canceled after 4m34s
release / android (push) Canceled after 4m39s
release / Build signed APK (releases and dev) (push) Canceled after 3m21s
TrackRef gains the unavailable flag the server already sends on album detail and search. TrackRow greys such a row with '· File missing' and hides like, radio, add and the menu, as playlist rows already do. Every player-store entry point (playQueue, enqueue, play next, and a refetched mix) drops missing files; playQueue keeps the chosen track as the start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
} = $props();
|
||||
|
||||
const track = $derived(tracks[index]);
|
||||
// #5418: the file is gone. The row stays, greyed, so an album still reads
|
||||
// in order, but there is nothing to play, like or queue.
|
||||
const missing = $derived(!!track.unavailable);
|
||||
|
||||
const isSelected = $derived(selection.isSelected(track.id));
|
||||
const selectMode = $derived(selection.active);
|
||||
@@ -61,9 +64,13 @@
|
||||
title={track.title}
|
||||
{subtitle}
|
||||
durationSec={track.duration_sec}
|
||||
{track}
|
||||
track={missing ? null : track}
|
||||
ariaLabel={track.title}
|
||||
rowTitle={missing
|
||||
? 'This track’s file is missing from the library, so it can’t be played. It returns automatically if the file comes back.'
|
||||
: undefined}
|
||||
{isSelected}
|
||||
disabled={missing}
|
||||
onActivate={activate}
|
||||
>
|
||||
{#snippet lead()}
|
||||
@@ -88,4 +95,10 @@
|
||||
<Check size={14} strokeWidth={2} />
|
||||
</button>
|
||||
{/snippet}
|
||||
|
||||
{#snippet note()}
|
||||
{#if missing}
|
||||
<span class="text-error-fg"> · File missing</span>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</TrackListRow>
|
||||
|
||||
@@ -89,6 +89,20 @@ describe('TrackRow', () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// #5418: a missing file stays in the list, greyed, with nothing to act on.
|
||||
test('a missing file is marked, does not play, and offers no actions', async () => {
|
||||
const withMissing = [{ ...tracks[0], unavailable: true }, tracks[1]];
|
||||
render(TrackRow, { props: { tracks: withMissing, index: 0 } });
|
||||
const row = screen.getByRole('button', { name: 'So What' });
|
||||
expect(row).toHaveAttribute('aria-disabled', 'true');
|
||||
expect(screen.getByText(/file missing/i)).toBeInTheDocument();
|
||||
await fireEvent.click(row);
|
||||
expect(playQueue).not.toHaveBeenCalled();
|
||||
expect(screen.queryByRole('button', { name: /add .* to queue/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /play radio/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /track actions for/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('selection mode', () => {
|
||||
test('clicking the checkbox toggles selection without playing', async () => {
|
||||
render(TrackRow, { props: { tracks, index: 0 } });
|
||||
|
||||
Reference in New Issue
Block a user