From 6bee204280e35a1b075aeae98b0c5c45c1e0c88d Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 3 Mar 2024 17:26:39 +0300 Subject: [PATCH] myrate-update-fix --- src/components/Article/RatingControl.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Article/RatingControl.tsx b/src/components/Article/RatingControl.tsx index a9849eb3..63d7b91b 100644 --- a/src/components/Article/RatingControl.tsx +++ b/src/components/Article/RatingControl.tsx @@ -87,7 +87,8 @@ export const RatingControl = (props: RatingControlProps) => { const fakeId = Date.now() + Math.floor(Math.random() * 1000) // const savedRatings = [...props.ratings] mergeProps(props.ratings, [...props.ratings, { ...rateInput, id: fakeId, created_by: author() }]) - await createReaction(rateInput) + const newReaction = await createReaction(rateInput) + setMyRate(newReaction) // Добавляем созданный голос в myRate console.debug(`[RatingControl.handleRatingChange] your ${voteKind} vote was created`) } else { console.debug('[RatingControl.handleRatingChange] already has your vote', myRate())