File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
package/src/components/MessageInput/hooks Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 1- import { useCallback , useEffect , useState } from 'react' ;
1+ import { useCallback , useEffect } from 'react' ;
22
33import { LocalVoiceRecordingAttachment } from 'stream-chat' ;
44
@@ -19,7 +19,6 @@ export const useAudioRecorder = ({
1919 audioRecorderManager,
2020 sendMessage,
2121} : Pick < MessageInputContextValue , 'audioRecorderManager' | 'sendMessage' > ) => {
22- const [ isScheduledForSubmit , setIsScheduleForSubmit ] = useState ( false ) ;
2322 const { attachmentManager } = useMessageComposer ( ) ;
2423
2524 /**
@@ -43,13 +42,6 @@ export const useAudioRecorder = ({
4342 [ stopVoiceRecording ] ,
4443 ) ;
4544
46- useEffect ( ( ) => {
47- if ( isScheduledForSubmit ) {
48- sendMessage ( ) ;
49- setIsScheduleForSubmit ( false ) ;
50- }
51- } , [ isScheduledForSubmit , sendMessage ] ) ;
52-
5345 /**
5446 * Function to start voice recording. Will return whether access is granted
5547 * with regards to the microphone permission as that's how the underlying
@@ -113,8 +105,8 @@ export const useAudioRecorder = ({
113105 audioRecorderManager . reset ( ) ;
114106
115107 if ( sendOnComplete ) {
116- await attachmentManager . uploadAttachment ( audioFile ) ;
117- setIsScheduleForSubmit ( true ) ;
108+ attachmentManager . upsertAttachments ( [ audioFile ] ) ;
109+ sendMessage ( ) ;
118110 } else {
119111 await attachmentManager . uploadAttachment ( audioFile ) ;
120112 }
You can’t perform that action at this time.
0 commit comments