diff --git a/client/src/components/chat-conversation/chat-conversation.container.jsx b/client/src/components/chat-conversation/chat-conversation.container.jsx index ffaa3d807..4a2992f6d 100644 --- a/client/src/components/chat-conversation/chat-conversation.container.jsx +++ b/client/src/components/chat-conversation/chat-conversation.container.jsx @@ -44,7 +44,6 @@ function ChatConversationContainer({ bodyshop, selectedConversation }) { messages.forEach((message) => { const messageRef = client.cache.identify(message); - // Write the new message to the cache client.cache.writeFragment({ id: messageRef, @@ -72,6 +71,9 @@ function ChatConversationContainer({ bodyshop, selectedConversation }) { const alreadyExists = existingMessages.some((msg) => msg.__ref === messageRef); if (alreadyExists) return existingMessages; return [...existingMessages, { __ref: messageRef }]; + }, + updated_at() { + return message.created_at; } } }); @@ -91,13 +93,6 @@ function ChatConversationContainer({ bodyshop, selectedConversation }) { } }); }); - - client.cache.modify({ - id: client.cache.identify({ __typename: "conversations", id: conversationId }), - fields: { - unreadcnt: () => 0 - } - }); }, [client.cache] );