Skip to content

resetTranscript() is not working properly. #248

@Chirimiri97

Description

@Chirimiri97

I am using react-speech-recognition like this -

const { transcript, listening, resetTranscript } = useSpeechRecognition();
useEffect(() => {
		if (transcript) {
			dispatch(setPrompt(transcript));
		}
	}, [transcript, dispatch]);


<Textarea value={prompt} 
        onKeyDown={(e) => {
        	if (e.key === "Enter" && !e.shiftKey) {
        		e.preventDefault();
        
        		if (listening) {
        			SpeechRecognition.abortListening();
        			resetTranscript();
        		}
        
        		handleGenerateClick();
        
        		setTimeout(() => {
        			resetTranscript();
        			dispatch(setPrompt(""));
        		}, 200);
        	}
}} />

The issue I am facing is, resetTranscript() is not working properly on Chrome. After abort also, whenever I come back to this component, due to useEffect the transcript is remaining in the instance.

Can you please help me out!

The version I am using is - 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions