fix(lint): resolve eslint errors and warnings
- audioService: replace 'as any' with 'as unknown as AudioService' in resetInstance() to satisfy @typescript-eslint/no-explicit-any - SongPage: add isReady to spacebar useEffect deps so the handler always sees the current readiness state - useWaveform: add containerRef to deps (stable ref, safe to include); suppress exhaustive-deps for options.onReady with explanation — adding an un-memoized callback would cause initialization on every render Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -392,7 +392,7 @@ export function SongPage() {
|
||||
};
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
return () => window.removeEventListener("keydown", handleKeyDown);
|
||||
}, [isPlaying, play, pause]);
|
||||
}, [isPlaying, isReady, play, pause]);
|
||||
|
||||
// ── Comments ─────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user