File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ const TextGeneratorContainer = () => {
2929 if ( typeof window !== 'undefined' ) {
3030 const isSpeechSupported =
3131 'speechSynthesis' in window && typeof SpeechSynthesisUtterance !== 'undefined' ;
32- useTextGeneratorStore . setState ( { isSpeechSupported } ) ;
32+ const store : Partial < ReturnType < typeof useTextGeneratorStore . getState > > =
33+ useTextGeneratorStore . getState ( ) ;
34+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
35+ if ( store && typeof store . _setIsSpeechSupported === 'function' ) {
36+ store . _setIsSpeechSupported ( isSpeechSupported ) ;
37+ }
3338 }
3439
3540 if ( status === 'authenticated' ) {
Original file line number Diff line number Diff line change @@ -37,11 +37,4 @@ export const useTextGeneratorStore = create<TextGeneratorState>()(
3737 } ) )
3838) ;
3939
40- if ( typeof window !== 'undefined' ) {
41- const isSpeechSupported =
42- 'speechSynthesis' in window && typeof SpeechSynthesisUtterance !== 'undefined' ;
43- useTextGeneratorStore . getState ( ) . _setIsSpeechSupported ( isSpeechSupported ) ;
44- console . log ( 'Speech Synthesis Supported:' , isSpeechSupported ) ;
45- }
46-
4740export default useTextGeneratorStore ;
You can’t perform that action at this time.
0 commit comments