From eac187c4cabd31b7e1379dea88c19406f27062c5 Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 2 Sep 2024 01:11:52 -0700 Subject: [PATCH] dont render `0` --- src/lib/custom-animations/CountWheel.web.tsx | 41 ++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/lib/custom-animations/CountWheel.web.tsx b/src/lib/custom-animations/CountWheel.web.tsx index bf9ad45be2..a00f60772d 100644 --- a/src/lib/custom-animations/CountWheel.web.tsx +++ b/src/lib/custom-animations/CountWheel.web.tsx @@ -52,6 +52,8 @@ export function CountWheel({ const [prevCount, setPrevCount] = React.useState(likeCount) const prevIsLiked = React.useRef(isLiked) + const formattedCount = formatCount(likeCount) + const formattedPrevCount = formatCount(prevCount) React.useEffect(() => { if (isLiked === prevIsLiked.current) { @@ -73,29 +75,28 @@ export function CountWheel({ prevIsLiked.current = isLiked }, [isLiked, likeCount, shouldAnimate, shouldRoll]) - const formattedCount = formatCount(likeCount) - const formattedPrevCount = formatCount(prevCount) + if (likeCount < 1) { + return null + } return ( - {likeCount > 0 ? ( - - - {formattedCount} - - - ) : null} + + + {formattedCount} + +