fix invalid hook call

This commit is contained in:
Ramón Souza 2024-06-17 13:15:08 -03:00
parent 051b2e152b
commit 88e67259f0

View File

@ -65,6 +65,7 @@ const AudioCaptionsSpeech: React.FC<AudioCaptionsSpeechProps> = ({
const prevTranscriptRef = useRef(''); const prevTranscriptRef = useRef('');
const [setSpeechLocaleMutation] = useMutation(SET_SPEECH_LOCALE); const [setSpeechLocaleMutation] = useMutation(SET_SPEECH_LOCALE);
const isAudioTranscriptionEnabled = useIsAudioTranscriptionEnabled(); const isAudioTranscriptionEnabled = useIsAudioTranscriptionEnabled();
const fixedLocaleResult = useFixedLocale();
const setUserSpeechLocale = (speechLocale: string, provider: string) => { const setUserSpeechLocale = (speechLocale: string, provider: string) => {
if (speechLocale !== '') { if (speechLocale !== '') {
@ -78,7 +79,7 @@ const AudioCaptionsSpeech: React.FC<AudioCaptionsSpeechProps> = ({
}; };
const setDefaultLocale = () => { const setDefaultLocale = () => {
if (useFixedLocale() || localeAsDefaultSelected()) { if (fixedLocaleResult || localeAsDefaultSelected()) {
setSpeechLocale(getLocale(), setUserSpeechLocale); setSpeechLocale(getLocale(), setUserSpeechLocale);
} else { } else {
setSpeechLocale(navigator.language, setUserSpeechLocale); setSpeechLocale(navigator.language, setUserSpeechLocale);
@ -101,7 +102,7 @@ const AudioCaptionsSpeech: React.FC<AudioCaptionsSpeechProps> = ({
speechRecognition.continuous = true; speechRecognition.continuous = true;
speechRecognition.interimResults = true; speechRecognition.interimResults = true;
if (useFixedLocale() || localeAsDefaultSelected()) { if (fixedLocaleResult || localeAsDefaultSelected()) {
setUserLocaleProperty(getLocale(), setUserSpeechLocale); setUserLocaleProperty(getLocale(), setUserSpeechLocale);
} else { } else {
setUserLocaleProperty(navigator.language, setUserSpeechLocale); setUserLocaleProperty(navigator.language, setUserSpeechLocale);