@@ -21,7 +21,7 @@ interface Props {
21
21
export const Chat = memo ( ( { stopConversationRef } : Props ) => {
22
22
const {
23
23
state : { selectedConversation, conversations } ,
24
- dispatch : homeDispatch ,
24
+ dispatch,
25
25
} = useContext ( ReactStreamChatContext )
26
26
27
27
const [ currentMessage , setCurrentMessage ] = useState < Message > ( )
@@ -52,12 +52,12 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
52
52
messages : [ ...selectedConversation . messages , message ] ,
53
53
}
54
54
}
55
- homeDispatch ( {
55
+ dispatch ( {
56
56
field : 'selectedConversation' ,
57
57
value : updatedConversation ,
58
58
} )
59
- homeDispatch ( { field : 'loading' , value : true } )
60
- homeDispatch ( { field : 'messageIsStreaming' , value : true } )
59
+ dispatch ( { field : 'loading' , value : true } )
60
+ dispatch ( { field : 'messageIsStreaming' , value : true } )
61
61
if ( updatedConversation . messages . length === 1 ) {
62
62
const { content } = message
63
63
const customName =
@@ -67,7 +67,7 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
67
67
name : customName ,
68
68
}
69
69
}
70
- homeDispatch ( { field : 'loading' , value : false } )
70
+ dispatch ( { field : 'loading' , value : false } )
71
71
const interval = 500 // 500ms
72
72
const encoder = new TextEncoder ( )
73
73
@@ -176,7 +176,7 @@ QuickSort is an efficient, in-place sorting algorithm that, in practice, outperf
176
176
...updatedConversation ,
177
177
messages : updatedMessages ,
178
178
}
179
- homeDispatch ( {
179
+ dispatch ( {
180
180
field : 'selectedConversation' ,
181
181
value : updatedConversation ,
182
182
} )
@@ -196,7 +196,7 @@ QuickSort is an efficient, in-place sorting algorithm that, in practice, outperf
196
196
...updatedConversation ,
197
197
messages : updatedMessages ,
198
198
}
199
- homeDispatch ( {
199
+ dispatch ( {
200
200
field : 'selectedConversation' ,
201
201
value : updatedConversation ,
202
202
} )
@@ -214,9 +214,9 @@ QuickSort is an efficient, in-place sorting algorithm that, in practice, outperf
214
214
if ( updatedConversations . length === 0 ) {
215
215
updatedConversations . push ( updatedConversation )
216
216
}
217
- homeDispatch ( { field : 'conversations' , value : updatedConversations } )
217
+ dispatch ( { field : 'conversations' , value : updatedConversations } )
218
218
saveConversations ( updatedConversations )
219
- homeDispatch ( { field : 'messageIsStreaming' , value : false } )
219
+ dispatch ( { field : 'messageIsStreaming' , value : false } )
220
220
}
221
221
} ,
222
222
[ conversations , selectedConversation , stopConversationRef ] ,
0 commit comments