fix(home): voice input text persistence bugs#3737
Conversation
PR SummaryMedium Risk Overview This extracts Written by Cursor Bugbot for commit 8549d3c. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR fixes two speech-recognition persistence bugs in the Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant TC as toggleListening
participant SR as startRecognition
participant RR as restartRecognition
participant WA as Web Speech API
participant RS as React State
U->>TC: clicks mic button (start)
TC->>SR: startRecognition()
SR->>WA: new SpeechRecognitionAPI()
SR->>WA: recognition.start()
WA-->>SR: success → returns true
SR-->>TC: true
TC->>RS: setIsListening(true)
WA-->>SR: onresult(event)
SR->>RS: setValue(prefix + transcript)
SR->>SR: valueRef.current = newVal
note over WA: Long pause / natural end
WA-->>SR: onend()
SR->>SR: prefixRef.current = valueRef.current
SR->>WA: recognition.start() (same instance)
U->>U: types in textarea
U->>RR: handleInputChange → restartRecognition(newValue)
RR->>RR: prefixRef.current = newValue
RR->>WA: recognitionRef.current.abort()
WA-->>SR: onerror('aborted') → guard fails → early exit
WA-->>SR: onend() → guard fails → early exit
RR->>SR: startRecognition()
SR->>WA: new instance + start()
WA-->>SR: success
U->>U: submits message
U->>RR: handleSubmit → restartRecognition('')
RR->>RR: prefixRef.current = ''
RR->>WA: abort old instance
RR->>SR: startRecognition()
SR->>WA: new instance + start()
U->>TC: clicks mic button (stop)
TC->>WA: recognitionRef.current.stop()
TC->>RS: setIsListening(false)
Reviews (3): Last reviewed commit: "fix(home): reset speech prefix on submit..." | Re-trigger Greptile |
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx
Outdated
Show resolved
Hide resolved
|
@greptile |
|
@cursor review |
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx
Outdated
Show resolved
Hide resolved
|
@greptile |
|
@cursor review |
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx
Show resolved
Hide resolved
|
@greptile |
|
@cursor review |
* fix(home): voice input text persistence bugs * fix(home): gate setIsListening on startRecognition success * fix(home): handle startRecognition failure in restartRecognition * fix(home): reset speech prefix on submit while mic is active
Summary
startRecognitionandrestartRecognitionhelpers for cleaner speech lifecycle managementrecognition.start()for robustnessType of Change
Testing
Tested manually
Checklist