From 2791d3453a84e0a5669d1e24355ebf659b490193 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 28 Sep 2022 15:55:56 -0500 Subject: [PATCH] Chats: update chat cache in streaming --- app/soapbox/actions/streaming.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/soapbox/actions/streaming.ts b/app/soapbox/actions/streaming.ts index 5ec405464..b6b8ac0bc 100644 --- a/app/soapbox/actions/streaming.ts +++ b/app/soapbox/actions/streaming.ts @@ -1,5 +1,6 @@ import { getSettings } from 'soapbox/actions/settings'; import messages from 'soapbox/locales/messages'; +import { queryClient } from 'soapbox/queries/client'; import { updatePageItem, appendPageItem } from 'soapbox/utils/queries'; import { play, soundCache } from 'soapbox/utils/sounds'; @@ -52,8 +53,9 @@ interface ChatPayload extends Omit { } const updateChat = (payload: ChatPayload) => { - const { last_message: lastMessage } = payload; + const { id: chatId, last_message: lastMessage } = payload; + queryClient.setQueryData(['chats', 'chat', chatId], payload as any); updatePageItem(['chats', 'search'], payload as any, (o, n) => o.id === n.id); if (lastMessage) {