Skip to content

Commit 9e29c2b

Browse files
committed
Revert "Merge pull request #820 from GetStream/fix-threadlist-check"
This reverts commit ccdef52, reversing changes made to 004b425.
1 parent 5708201 commit 9e29c2b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

package/src/components/MessageList/MessageList.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ export const MessageList = <
950950
setTargetedMessage,
951951
StickyHeader,
952952
targetedMessage,
953+
threadList,
953954
typingEventsEnabled,
954955
} = useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();
955956
const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();
@@ -973,6 +974,13 @@ export const MessageList = <
973974
const { loadMoreThread, thread } = useThreadContext<At, Ch, Co, Ev, Me, Re, Us>();
974975
const { t, tDateTimeParser } = useTranslationContext();
975976

977+
// This needs to happen here because there is already a threadList prop added to the MessageList
978+
if (thread?.id && !threadList) {
979+
throw new Error(
980+
'Please add a threadList prop to your Channel component when rendering a thread list. Check our Channel documentation for more info: https://getstream.io/chat/docs/sdk/reactnative/core-components/channel/#threadlist',
981+
);
982+
}
983+
976984
return (
977985
<MessageListWithContext
978986
{...{

package/src/components/Thread/Thread.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
MessageInput as DefaultMessageInput,
77
MessageInputProps,
88
} from '../MessageInput/MessageInput';
9-
import { useChannelContext } from '../../contexts/channelContext/ChannelContext';
109
import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
1110
import {
1211
MessagesContextValue,
@@ -164,17 +163,10 @@ export const Thread = <
164163
props: ThreadProps<At, Ch, Co, Ev, Me, Re, Us>,
165164
) => {
166165
const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();
167-
const { threadList } = useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();
168166
const { MessageList } = useMessagesContext<At, Ch, Co, Ev, Me, Re, Us>();
169167
const { closeThread, loadMoreThread, reloadThread, thread } =
170168
useThreadContext<At, Ch, Co, Ev, Me, Re, Us>();
171169

172-
if (thread?.id && !threadList) {
173-
throw new Error(
174-
'Please add a threadList prop to your Channel component when rendering a thread list. Check our Channel documentation for more info: https://getstream.io/chat/docs/sdk/reactnative/core-components/channel/#threadlist',
175-
);
176-
}
177-
178170
return (
179171
<ThreadWithContext<At, Ch, Co, Ev, Me, Re, Us>
180172
{...{

0 commit comments

Comments
 (0)