Skip to content

Commit

Permalink
馃悰 fix: remove originData for dom
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jan 22, 2024
1 parent 1ae3a96 commit 76f45f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/ChatItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const ChatItem = memo<ChatItemProps>((props) => {
errorMessage,
chatItemRenderConfig,
onDoubleClick,
originData = {},
...restProps
} = props;
const { mobile } = useResponsive();
Expand All @@ -55,15 +56,15 @@ const ChatItem = memo<ChatItemProps>((props) => {
const dom = (
<Avatar
addon={avatarAddon}
avatar={avatar}
avatar={originData.avatar}
loading={loading}
onClick={onAvatarClick}
placement={placement}
size={mobile ? MOBILE_AVATAR_SIZE : undefined}
/>
);
return chatItemRenderConfig?.avatarRender?.(props, dom) || dom;
}, [avatar, placement, mobile, loading]);
}, [originData.avatar, placement, mobile, loading]);

const messageContentDom = useMemo(() => {
if (chatItemRenderConfig?.contentRender === false) return null;
Expand Down
11 changes: 10 additions & 1 deletion src/ProChat/container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ProChatProps<T extends Record<string, any>> extends ChatProps<T
style?: CSSProperties;
className?: string;
chatRef?: ProChatChatReference;
appStyle?: CSSProperties;
}

export function ProChat<T extends Record<string, any> = Record<string, any>>({
Expand All @@ -24,11 +25,19 @@ export function ProChat<T extends Record<string, any> = Record<string, any>>({
style,
className,
chatItemRenderConfig,
appStyle,
...props
}: ProChatProps<T>) {
return (
<ProChatProvider {...props} devtoolOptions={__PRO_CHAT_STORE_DEVTOOLS__}>
<Container>
<Container
style={{
height: '100%',
width: '100%',
...appStyle,
}}
className={className}
>
<App
chatItemRenderConfig={chatItemRenderConfig}
chatInput={renderInput}
Expand Down

0 comments on commit 76f45f8

Please sign in to comment.