diff --git a/app/src/components/CapturesTab/CapturesTab.tsx b/app/src/components/CapturesTab/CapturesTab.tsx index 525cdb39..65c66103 100644 --- a/app/src/components/CapturesTab/CapturesTab.tsx +++ b/app/src/components/CapturesTab/CapturesTab.tsx @@ -154,6 +154,8 @@ export function CapturesTab() { const playerIsPlaying = usePlayerStore((s) => s.isPlaying); const isPlayerVisible = !!audioUrl; + const setIsPlaying = usePlayerStore((s) => s.setIsPlaying); + const addPendingGeneration = useGenerationStore((s) => s.addPendingGeneration); const pendingGenerationIds = useGenerationStore((s) => s.pendingGenerationIds); @@ -410,6 +412,12 @@ export function CapturesTab() { const handlePlayAs = (voice?: VoiceProfileResponse) => { if (!selected) return; + // Stop the current playback when the button is in its 'playing' state + // and the user clicked the main button without picking a new voice. + if (!voice && playbackState === 'playing') { + setIsPlaying(false); + return; + } const target = voice ?? playAsVoice; if (!target) { toast({ diff --git a/app/src/components/ChordPicker/ChordPicker.tsx b/app/src/components/ChordPicker/ChordPicker.tsx index 933bac2e..23150e23 100644 --- a/app/src/components/ChordPicker/ChordPicker.tsx +++ b/app/src/components/ChordPicker/ChordPicker.tsx @@ -95,11 +95,12 @@ export function ChordPicker({ if (prev.has(canonical)) return prev; const next = new Set(prev); next.add(canonical); - // Update peak whenever the live set grows. Comparing against - // the captured chord (which may be the previous saved value) - // would lose the user's first new keypress. setCaptured((prevCaptured) => { const candidate = sortChordKeys(Array.from(next)); + // First key in a fresh sequence replaces the peak — otherwise a + // user trying to swap a longer saved chord for a shorter one is + // stuck because their candidate never beats the seed length. + if (prev.size === 0) return candidate; return candidate.length >= prevCaptured.length ? candidate : prevCaptured; }); return next;