File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
package/src/contexts/channelsStateContext Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import { useCallback , useMemo } from 'react' ;
22
3- import type { Channel as ChannelType } from 'stream-chat' ;
3+ import type { Channel as ChannelType , LocalMessage } from 'stream-chat' ;
44
55import { useChannelsStateContext } from './ChannelsStateContext' ;
66
@@ -58,7 +58,7 @@ export function useChannelState<
5858 const cid = channel ?. id || 'id' ; // in case channel is not initialized, use generic id string for indexing
5959 const { setState, state } = useChannelsStateContext < StreamChatGenerics > ( ) ;
6060
61- const [ threadMessages , setThreadMessages ] = useStateManager (
61+ const [ threadMessages , setThreadMessagesInternal ] = useStateManager (
6262 {
6363 cid,
6464 key : 'threadMessages' ,
@@ -67,6 +67,10 @@ export function useChannelState<
6767 } ,
6868 ( threadId && channel ?. state ?. threads ?. [ threadId ] ) || [ ] ,
6969 ) ;
70+ const setThreadMessages = useCallback (
71+ ( value : LocalMessage [ ] ) => setThreadMessagesInternal ( [ ...value ] ) ,
72+ [ setThreadMessagesInternal ] ,
73+ ) ;
7074
7175 return {
7276 setThreadMessages,
You can’t perform that action at this time.
0 commit comments