import React, { PropsWithChildren, useMemo } from 'react'; import { Conversation } from '@tencentcloud/chat'; import { TUIConversationProvider, TUIConversationContextValue } from '../../context/TUIConversationContext'; import { TUIConversationList } from '../TUIConversationList'; import { TUIProfile } from '../TUIProfile'; interface TUIConversationProps { createConversation?:(conversationID:string) => Promise, deleteConversation?:(conversationID:string) => Promise, filterConversation?:(conversationList: Array) => Array, } export function UnMemoizedTUIConversation( props: PropsWithChildren, ):React.ReactElement { const { children, createConversation, deleteConversation, filterConversation, } = props; const TUIConversationValue: TUIConversationContextValue = useMemo( () => ({ createConversation, deleteConversation, filterConversation, }), [ createConversation, deleteConversation, filterConversation, ], ); return ( {children || ( <> )} ); } export const TUIConversation = React.memo( UnMemoizedTUIConversation, )as typeof UnMemoizedTUIConversation;