From e493529af82411a625aa68aaeb4d517f84ec9303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicole=20Miko=C5=82ajczyk?= Date: Sun, 25 May 2025 15:00:30 +0200 Subject: [PATCH] pl-fe: fix streaming annoucnement reactions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicole Mikołajczyk --- packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts b/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts index 8804f0741..7876b9db7 100644 --- a/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts @@ -26,14 +26,14 @@ import { useTimelineStream } from './use-timeline-stream'; import type { Announcement, AnnouncementReaction, FollowRelationshipUpdate, Relationship, StreamingEvent } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; -const updateAnnouncementReactions = ({ announcement_id: id, name }: AnnouncementReaction) => { +const updateAnnouncementReactions = (reaction: AnnouncementReaction) => { queryClient.setQueryData(['announcements'], (prevResult: Announcement[]) => prevResult.map(value => { - if (value.id !== id) return value; + if (value.id !== reaction.announcement_id) return value; return { ...value, - reactions: updateReactions(value.reactions, name, -1, true), + reactions: updateReactions(value.reactions, reaction.name, reaction.count, undefined, true), }; }), );