Fix a gap under Friends listening, and lyrics failing while LRCLIB's exact lookup is overloaded

The feed's itemLayoutAnimation left the cards behind when the header above them shrank
(your own card's lyrics loading). LRCLIB rate-limits /api/get on its own; fall back to search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y2iUsKEWDuRGjK5FPmcUP
This commit is contained in:
2026-10-15 13:16:18 -04:00
co-authored by Claude Opus 5.5
parent 82ff5336aa
commit b705bfcce4
3 changed files with 19 additions and 7 deletions
+14
View File
@@ -55,6 +55,20 @@ describe('lyrics', () => {
expect(body.plain).toBe('the one');
});
it("uses the search when LRCLIB's exact lookup is rate-limited", async () => {
const { id } = await upsertTrack({ title: 'Midnight City', artist: 'M83', durationMs: 241_000 });
vi.stubGlobal(
'fetch',
routeFetch([
[/\/api\/get\?/, () => json({ message: 'slow down' }, 429)],
[/\/api\/search\?/, () => json([record()])],
]),
);
const res = await lyrics(id);
expect(res.statusCode).toBe(200);
expect(res.json().synced).toHaveLength(2);
});
it('returns null when nothing matches, and 503 when LRCLIB is down', async () => {
const { id } = await upsertTrack({ title: 'Unknown', artist: 'Nobody', durationMs: 100_000 });
vi.stubGlobal('fetch', routeFetch([[/lrclib/, () => json({ message: 'down' }, 500)]]));