Skip to content

Commit 2bc305b

Browse files
committed
fix: prevent double transcription when auto-dictation triggers from notes
Use tRPC mutation directly instead of useRecording hook in NotePage. The widget handles audio capture, so using useRecording in both places caused double transcription.
1 parent 2baf122 commit 2bc305b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/desktop/src/renderer/main/pages/notes/components/note-wrapper.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Note from "./note";
77
import { NoteEditor } from "./note-editor";
88
import { FileTextIcon } from "lucide-react";
99
import { Button } from "@/components/ui/button";
10-
import { useRecording } from "@/hooks/useRecording";
1110

1211
type NotePageProps = {
1312
noteId: string;
@@ -22,7 +21,11 @@ export default function NotePage({
2221
}: NotePageProps) {
2322
const navigate = useNavigate();
2423
const utils = api.useUtils();
25-
const { startRecording } = useRecording();
24+
25+
// Use tRPC mutation directly to signal recording start
26+
// We don't use the full useRecording hook here because the widget handles
27+
// audio capture. Using useRecording in both places causes double transcription.
28+
const startRecordingMutation = api.recording.signalStart.useMutation();
2629

2730
// State
2831
const [noteTitle, setNoteTitle] = useState("");
@@ -120,11 +123,11 @@ export default function NotePage({
120123
useEffect(() => {
121124
if (editorReady && autoRecord && !autoRecordTriggeredRef.current) {
122125
autoRecordTriggeredRef.current = true;
123-
startRecording().catch((error) => {
126+
startRecordingMutation.mutateAsync().catch((error) => {
124127
console.error("Failed to auto-start recording:", error);
125128
});
126129
}
127-
}, [editorReady, autoRecord, startRecording]);
130+
}, [editorReady, autoRecord, startRecordingMutation]);
128131

129132
// Handle title change
130133
const handleTitleChange = useCallback(

0 commit comments

Comments
 (0)