diff --git a/web/src/components/layout/Player.test.tsx b/web/src/components/layout/Player.test.tsx
index 5801b28..a7c8092 100644
--- a/web/src/components/layout/Player.test.tsx
+++ b/web/src/components/layout/Player.test.tsx
@@ -58,6 +58,7 @@ function renderBar(extra?: React.ReactNode) {
calls = mockFetch({
'GET /api/v1/friends': () => ({ friends: [{ id: 3, name: 'Anna' }] }),
...Object.fromEntries([1, 2, 3, 4, 5].map((n) => [`GET /api/v1/tracks/${n}/peaks`, () => ({ count: 120, peaks: new Array(120).fill(100) })])),
+ ...Object.fromEntries([1, 2, 3, 4, 5].map((n) => [`GET /api/v1/friends/3/tracks/${n}/peaks`, () => ({ count: 120, peaks: new Array(120).fill(100) })])),
}).calls
return render(
@@ -439,10 +440,10 @@ test('the seek bar of a track of this server is the shape of the track', async (
expect(calls.some((c) => c.key === 'GET /api/v1/tracks/1/peaks')).toBe(true)
})
-test('a friend’s track has a plain bar, and its shape is not asked for', async () => {
+test('the seek bar of a friend’s track is its shape too, asked of the friend', async () => {
act(() => usePlayer.getState().playTracks([theirs(1)]))
const { container } = renderBar()
- await screen.findByLabelText('From Anna’s server')
- expect(container.querySelectorAll('footer [data-bar]').length).toBe(64)
- expect(calls.some((c) => c.key.includes('/peaks'))).toBe(false)
+ await waitFor(() => expect(container.querySelectorAll('footer [data-bar]').length).toBe(120))
+ expect(calls.some((c) => c.key === 'GET /api/v1/friends/3/tracks/1/peaks')).toBe(true)
+ expect(calls.some((c) => c.key === 'GET /api/v1/tracks/1/peaks')).toBe(false)
})
diff --git a/web/src/components/layout/PlayerBar.tsx b/web/src/components/layout/PlayerBar.tsx
index bd75699..4ec43f1 100644
--- a/web/src/components/layout/PlayerBar.tsx
+++ b/web/src/components/layout/PlayerBar.tsx
@@ -36,8 +36,8 @@ function usePlayPauseKey() {
function PlayerSeek({ track }: { track: QueuedTrack | null }) {
const positionMs = usePlayer((s) => s.positionMs)
const seek = usePlayer((s) => s.seek)
- // A friend's track has no shape here (the friend's server would have to work it out): its bar is flat.
- const peaks = usePeaks(track?.id ?? null, { enabled: track !== null && track.friend === undefined })
+ // A friend's track has its shape from the friend's server, which works it out the first time.
+ const peaks = usePeaks(track?.id ?? null, { friend: track?.friend })
return (
{formatTime(track ? positionMs : 0)}