@pubuduth-aplicy/chat-ui 2.1.13 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -11,6 +11,8 @@ import useChatUIStore from "../../stores/Zustant";
|
|
|
11
11
|
const Messages = () => {
|
|
12
12
|
const { selectedConversation } = useChatUIStore()
|
|
13
13
|
const {userId}=useChatContext()
|
|
14
|
+
console.log(selectedConversation); // Ensure chatId is correct
|
|
15
|
+
console.log(userId);
|
|
14
16
|
const { data: messages, isLoading, isError, error } = useMessages(selectedConversation?._id, userId);
|
|
15
17
|
// useListenMessages();
|
|
16
18
|
console.log("isLoading",isLoading);
|
|
@@ -42,15 +44,15 @@ const Messages = () => {
|
|
|
42
44
|
// </div>
|
|
43
45
|
|
|
44
46
|
<div className='px-4 flex-1 overflow-auto sm:px-6 lg:px-8'>
|
|
45
|
-
{messages
|
|
46
|
-
messages
|
|
47
|
+
{messages?.length > 0 &&
|
|
48
|
+
messages?.map((message: any) => (
|
|
47
49
|
<div key={message._id} ref={lastMessageRef}>
|
|
48
50
|
<Message message={message} />
|
|
49
51
|
</div>
|
|
50
52
|
))}
|
|
51
53
|
|
|
52
54
|
{/* {loading && [...Array(3)].map((_, idx) => <MessageSkeleton key={idx} />)} */}
|
|
53
|
-
{messages
|
|
55
|
+
{messages?.length === 0 && (
|
|
54
56
|
<p className='text-center'>Send a message to start the conversation</p>
|
|
55
57
|
)}
|
|
56
58
|
</div>
|