diff --git a/web/src/hooks/useWaveform.ts b/web/src/hooks/useWaveform.ts index 0edc39d..badf588 100755 --- a/web/src/hooks/useWaveform.ts +++ b/web/src/hooks/useWaveform.ts @@ -77,7 +77,12 @@ export function useWaveform( }; initializeAudio(); - }, [options.url, options.songId, options.bandId]); + // containerRef is a stable ref object — safe to include. + // options.onReady is intentionally omitted: it's a callback that callers + // may not memoize, and re-running initialization on every render would be + // worse than stale-closing over it for the brief window after mount. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [options.url, options.songId, options.bandId, containerRef]); const play = () => { audioService.play(options.songId ?? null, options.bandId ?? null) diff --git a/web/src/pages/SongPage.tsx b/web/src/pages/SongPage.tsx index a89ea88..72af380 100755 --- a/web/src/pages/SongPage.tsx +++ b/web/src/pages/SongPage.tsx @@ -392,7 +392,7 @@ export function SongPage() { }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); - }, [isPlaying, play, pause]); + }, [isPlaying, isReady, play, pause]); // ── Comments ───────────────────────────────────────────────────────────── diff --git a/web/src/services/audioService.ts b/web/src/services/audioService.ts index 26cb26e..31b691f 100755 --- a/web/src/services/audioService.ts +++ b/web/src/services/audioService.ts @@ -26,7 +26,7 @@ class AudioService { // For use in tests only public static resetInstance(): void { this.instance?.cleanup(); - this.instance = undefined as any; + this.instance = undefined as unknown as AudioService; } private createMediaElement(): HTMLAudioElement {