diff --git a/package.json b/package.json index 5fdcb95..b04659f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hearbit-ai", "private": true, - "version": "1.1.0", + "version": "1.1.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e375996..4741dc9 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Hearbit AI", - "version": "1.1.0", + "version": "1.1.1", "identifier": "com.hearbit-ai.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/App.tsx b/src/App.tsx index fa862dc..4619c80 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -360,7 +360,8 @@ Thanks!`
- {view === 'recorder' && ( + {/* Recorder - Persistent (Hidden via CSS to keep recording alive) */} +
- )} +
{view === 'transcription' && ( void; selectedModel: string; onModelChange: (model: string) => void; + isVisible: boolean; } interface AudioDevice { @@ -246,6 +247,12 @@ const Recorder: React.FC = ({ }; }, [isRecording, addToast]); // Dependencies for listener setup + // Ref for visibility to avoid closure staleness in interval + const isVisibleRef = useRef(props.isVisible); + useEffect(() => { + isVisibleRef.current = props.isVisible; + }, [props.isVisible]); + // Auto-Stop Interval Effect useEffect(() => { if (!isRecording || isPaused || isWaiting) return; @@ -255,8 +262,9 @@ const Recorder: React.FC = ({ const timeSinceSpeech = (now - lastSpeechTimeRef.current) / 1000; setSilenceDuration(timeSinceSpeech); - // AUTO STOP after 20 seconds of silence (ALL MODES) - if (timeSinceSpeech > 20 && !isStoppingRef.current) { + // AUTO STOP Logic + // Use Ref to get LATEST visibility instantly + if (isVisibleRef.current && timeSinceSpeech > 20 && !isStoppingRef.current) { console.log("Auto-stopping due to silence..."); isStoppingRef.current = true; addToast('Auto-stopped due to silence', 'info'); @@ -265,7 +273,7 @@ const Recorder: React.FC = ({ }, 1000); return () => clearInterval(interval); - }, [isRecording, isPaused, isWaiting, recordingMode, addToast]); // Added recordingMode dependency + }, [isRecording, isPaused, isWaiting, recordingMode, addToast]); // Removed props.isVisible dependency (using Ref) // Handle Auto Start Prop useEffect(() => {