@@ -108,7 +108,7 @@ type MessageInputPropsWithContext<
108108 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
109109> = Pick < AttachmentPickerContextValue , 'AttachmentPickerSelectionBar' > &
110110 Pick < ChatContextValue < StreamChatGenerics > , 'isOnline' > &
111- Pick < ChannelContextValue < StreamChatGenerics > , 'members' | 'threadList' | 'watchers' > &
111+ Pick < ChannelContextValue < StreamChatGenerics > , 'channel' | ' members' | 'threadList' | 'watchers' > &
112112 Pick <
113113 MessageInputContextValue < StreamChatGenerics > ,
114114 | 'additionalTextInputProps'
@@ -198,6 +198,7 @@ const MessageInputWithContext = <
198198 AudioRecordingLockIndicator,
199199 AudioRecordingPreview,
200200 AutoCompleteSuggestionList,
201+ channel,
201202 closeAttachmentPicker,
202203 closePollCreationDialog,
203204 cooldownEndsAt,
@@ -746,7 +747,6 @@ const MessageInputWithContext = <
746747 } ) ) ,
747748 } ;
748749
749- const { channel } = useChannelContext < StreamChatGenerics > ( ) ;
750750 const { aiState } = useAIState ( channel ) ;
751751
752752 const stopGenerating = useCallback ( ( ) => channel ?. stopAIResponse ( ) , [ channel ] ) ;
@@ -957,6 +957,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
957957 asyncMessagesSlideToCancelDistance : prevAsyncMessagesSlideToCancelDistance ,
958958 asyncUploads : prevAsyncUploads ,
959959 audioRecordingEnabled : prevAsyncMessagesEnabled ,
960+ channel : prevChannel ,
960961 closePollCreationDialog : prevClosePollCreationDialog ,
961962 editing : prevEditing ,
962963 fileUploads : prevFileUploads ,
@@ -982,6 +983,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
982983 asyncMessagesSlideToCancelDistance : nextAsyncMessagesSlideToCancelDistance ,
983984 asyncUploads : nextAsyncUploads ,
984985 audioRecordingEnabled : nextAsyncMessagesEnabled ,
986+ channel : nextChannel ,
985987 closePollCreationDialog : nextClosePollCreationDialog ,
986988 editing : nextEditing ,
987989 fileUploads : nextFileUploads ,
@@ -1025,6 +1027,11 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
10251027 return false ;
10261028 }
10271029
1030+ const channelEqual = prevChannel . cid === nextChannel . cid ;
1031+ if ( ! channelEqual ) {
1032+ return false ;
1033+ }
1034+
10281035 const asyncMessagesLockDistanceEqual =
10291036 prevAsyncMessagesLockDistance === nextAsyncMessagesLockDistance ;
10301037 if ( ! asyncMessagesLockDistanceEqual ) {
@@ -1160,7 +1167,7 @@ export const MessageInput = <
11601167 const { isOnline } = useChatContext ( ) ;
11611168 const ownCapabilities = useOwnCapabilitiesContext ( ) ;
11621169
1163- const { members, threadList, watchers } = useChannelContext < StreamChatGenerics > ( ) ;
1170+ const { channel , members, threadList, watchers } = useChannelContext < StreamChatGenerics > ( ) ;
11641171
11651172 const {
11661173 additionalTextInputProps,
@@ -1263,6 +1270,7 @@ export const MessageInput = <
12631270 AutoCompleteSuggestionHeader,
12641271 AutoCompleteSuggestionItem,
12651272 AutoCompleteSuggestionList,
1273+ channel,
12661274 clearEditingState,
12671275 clearQuotedMessageState,
12681276 closeAttachmentPicker,
0 commit comments