Skip to content

Commit 7908c3c

Browse files
authored
fix: use WithComponents instead of ComponentProvider in tests (#2891)
πŸš‚ #2890 Two minor follow-up fixes: - Typings for MessageListWrapper and MessageListItem overridable components. - Don't use private ComponentProvider API in tests, use WithComponents instead.
1 parent 872928c commit 7908c3c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

β€Žsrc/components/MessageList/__tests__/MessageList.test.jsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { Chat } from '../../Chat';
2121
import { MessageList } from '../MessageList';
2222
import { Channel } from '../../Channel';
2323
import {
24-
ComponentProvider,
2524
useChannelActionContext,
2625
useMessageContext,
26+
WithComponents,
2727
} from '../../../context';
2828
import { EmptyStateIndicator as EmptyStateIndicatorMock } from '../../EmptyStateIndicator';
2929
import { ScrollToBottomButton } from '../ScrollToBottomButton';
@@ -55,9 +55,9 @@ const renderComponent = ({ channelProps, chatClient, components = {}, msgListPro
5555
render(
5656
<Chat client={chatClient}>
5757
<Channel {...channelProps}>
58-
<ComponentProvider value={components}>
58+
<WithComponents overrides={components}>
5959
<MessageList {...msgListProps} />
60-
</ComponentProvider>
60+
</WithComponents>
6161
</Channel>
6262
</Chat>,
6363
);

β€Žsrc/context/ComponentContext.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ export type ComponentContextValue = {
241241
/** Custom UI component to display a message in the `VirtualizedMessageList`, does not have a default implementation */
242242
VirtualMessage?: React.ComponentType<FixedHeightMessageProps>;
243243
/** Custom UI component to wrap MessageList children. Default is the `ul` tag */
244-
MessageListWrapper?: React.ComponentType;
244+
MessageListWrapper?: React.ComponentType<PropsWithChildren>;
245245
/** Custom UI component to wrap each element of MessageList. Default is the `li` tag */
246-
MessageListItem?: React.ComponentType;
246+
MessageListItem?: React.ComponentType<PropsWithChildren>;
247247
};
248248

249249
export const ComponentContext = React.createContext<ComponentContextValue>({});

0 commit comments

Comments
Β (0)