From b0b7cf424d12900a3913ab45664a241014b2bfbf Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 16 Feb 2024 11:29:06 +0300 Subject: [PATCH] reactivity+ --- src/components/Article/RatingControl.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Article/RatingControl.tsx b/src/components/Article/RatingControl.tsx index 9170d71d..840c3828 100644 --- a/src/components/Article/RatingControl.tsx +++ b/src/components/Article/RatingControl.tsx @@ -34,7 +34,9 @@ export const RatingControl = (props: RatingControlProps) => { on( () => props.comment, (comment) => { - setTotal(comment?.stat?.rating || 0) + if (comment) { + setTotal(comment?.stat?.rating) + } }, { defer: true }, ), @@ -44,7 +46,9 @@ export const RatingControl = (props: RatingControlProps) => { on( () => props.shout, (shout) => { - setTotal(shout?.stat?.rating || 0) + if (shout) { + setTotal(shout?.stat?.rating) + } }, { defer: true }, ),