fix: prevent multiple ImportDialog instances from appearing
Fixed issue where ImportDialog was being rendered for each track in waveform mode, causing multiple unclosable dialogs to appear on page load. Changes: - Moved ImportDialog to renderControlsOnly mode only - Each track now has exactly one ImportDialog (rendered in controls column) - Removed duplicate ImportDialog from renderWaveformOnly mode - Removed ImportDialog from fallback return statement This ensures only one dialog appears per track, making it properly closable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -683,6 +683,7 @@ export function Track({
|
||||
// Render only controls
|
||||
if (renderControlsOnly) {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={cn(
|
||||
"w-48 flex-shrink-0 border-b border-r-4 p-2 flex flex-col gap-2 min-h-0 transition-all duration-200 cursor-pointer border-border",
|
||||
@@ -810,13 +811,23 @@ export function Track({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Import Dialog - Only render in controls mode to avoid duplicates */}
|
||||
<ImportDialog
|
||||
open={showImportDialog}
|
||||
onClose={handleImportCancel}
|
||||
onImport={handleImport}
|
||||
fileName={pendingFile?.name}
|
||||
sampleRate={fileMetadata.sampleRate}
|
||||
channels={fileMetadata.channels}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// Render only waveform
|
||||
if (renderWaveformOnly) {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={cn(
|
||||
"relative bg-waveform-bg border-b transition-all duration-200",
|
||||
@@ -900,21 +911,11 @@ export function Track({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Import Dialog */}
|
||||
<ImportDialog
|
||||
open={showImportDialog}
|
||||
onClose={handleImportCancel}
|
||||
onImport={handleImport}
|
||||
fileName={pendingFile?.name}
|
||||
sampleRate={fileMetadata.sampleRate}
|
||||
channels={fileMetadata.channels}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// Render full track (both controls and waveform side by side)
|
||||
// This mode is no longer used - tracks are rendered separately with renderControlsOnly and renderWaveformOnly
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
|
||||
Reference in New Issue
Block a user