fix: move useRef before early return to comply with Rules of Hooks

Fixed React Hooks error by moving waveformScrollRef declaration
before the conditional early return. Hooks must always be called
in the same order on every render.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-19 11:07:15 +01:00
parent d7dfb8a746
commit 45d46067ea

View File

@@ -50,6 +50,7 @@ export function TrackList({
isPlaying = false,
}: TrackListProps) {
const [importDialogOpen, setImportDialogOpen] = React.useState(false);
const waveformScrollRef = React.useRef<HTMLDivElement>(null);
const handleImportTrack = (buffer: AudioBuffer, name: string) => {
if (onImportTrack) {
@@ -86,8 +87,6 @@ export function TrackList({
);
}
const waveformScrollRef = React.useRef<HTMLDivElement>(null);
return (
<div className="flex-1 flex flex-col overflow-hidden">
{/* Track List - Two Column Layout */}