cometchat / cometchat-uikit-react-native

Ready-to-use Chat UI Components for React Native
https://www.cometchat.com
Other
40 stars 25 forks source link

CometChatConversations component not updating in real-time when send a message #69

Closed jeliel-augusto20 closed 1 month ago

jeliel-augusto20 commented 1 month ago

Describe the problem

When I use CometChatConversations component, it only updates the inbox if I forcefully refresh the UI

What was the expected behavior?

CometChatConversations should update UI as soon as someone send as messages

Reproduction

Detail the steps taken to reproduce this error, and whether this issue can be reproduced consistently or if it is intermittent. Note: If clear, reproducable steps or the smallest sample app demonstrating misbehavior cannot be provided, we may not be able to follow up on this bug report.

Where applicable, please include:

  • The smallest possible sample app that reproduces the undesirable behavior
  • Log files (redact/remove sensitive information)
  • Application settings (redact/remove sensitive information)
  • Screenshots

https://github.com/user-attachments/assets/bebf8f79-f21c-4ace-bf19-6d1ad22976f8

Environment

Please provide the following:

Code


interface InboxWrapperProps {
conversations?: CometChat.ConversationsRequestBuilder;
onChatOperation?: (operation: ConversationActions, conversation: Conversation) => void;
onItemClick: (conversation: CometChat.Conversation) => void;
onNewMessage: () => void;
onSearch: (search: string) => void;
supportMode?: boolean;
onNewBroadcast: () => void;
}
export const InboxWrapper = ({
conversations,
supportMode = false,
onSearch,
onChatOperation,
onNewBroadcast,
onNewMessage,
onItemClick,
}: InboxWrapperProps) => {
const render = (conversation: Conversation) => {
return (
<InboxListItemWrapper
supportMode={supportMode}
conversation={conversation}
onItemClick={() => onItemClick(conversation)}
onChatOperation={(operation) => onChatOperation?.(operation, conversation)}
/>
);
};
return (
<div className='flex h-full w-[29%] flex-col border-b border-r border-base/stroke max-lg:!w-[33%]'>
<InboxHeader
onNewBroadcast={onNewBroadcast}
onSearch={onSearch}
onNewMessage={onNewMessage}
title='New conversations'
/>
  {conversations !== undefined && (
    <div className='inbox-container-scrollable h-full w-full overflow-y-auto'>
      <CometChatConversations
        title=''
        listItemView={render}
        emptyStateView={<div />}
        conversationsRequestBuilder={conversations}
        loadingStateView={<SkeletonLoader sectionSkeleton />}
        conversationsStyle={conversationsStyle}
      />
    </div>
  )}
</div>

); };```