diff --git a/src/components/BeerIndex/BeerCard.tsx b/src/components/BeerIndex/BeerCard.tsx index 204ac61..620af43 100644 --- a/src/components/BeerIndex/BeerCard.tsx +++ b/src/components/BeerIndex/BeerCard.tsx @@ -9,7 +9,7 @@ import BeerPostLikeButton from '../BeerById/BeerPostLikeButton'; const BeerCard: FC<{ post: z.infer }> = ({ post }) => { const { user } = useContext(UserContext); - const { mutate, likeCount } = useGetBeerPostLikeCount(post.id); + const { mutate, likeCount, isLoading } = useGetBeerPostLikeCount(post.id); return (
@@ -44,12 +44,14 @@ const BeerCard: FC<{ post: z.infer }> = ({ post }) = {post.abv}% ABV {post.ibu} IBU
- - liked by {likeCount} user{likeCount === 1 ? '' : 's'} - + {!isLoading && ( + + liked by {likeCount} user{likeCount === 1 ? '' : 's'} + + )}
- {user && } + {!!user && }
diff --git a/src/components/BreweryIndex/BreweryCard.tsx b/src/components/BreweryIndex/BreweryCard.tsx index e4f8594..63cc934 100644 --- a/src/components/BreweryIndex/BreweryCard.tsx +++ b/src/components/BreweryIndex/BreweryCard.tsx @@ -11,7 +11,7 @@ const BreweryCard: FC<{ brewery: z.infer }> = ({ brewery, }) => { const { user } = useContext(UserContext); - const { likeCount, mutate } = useGetBreweryPostLikeCount(brewery.id); + const { likeCount, mutate, isLoading } = useGetBreweryPostLikeCount(brewery.id); return (
@@ -40,7 +40,7 @@ const BreweryCard: FC<{ brewery: z.infer }> = ({
- liked by {likeCount} users + {!isLoading && liked by {likeCount} users} {user && ( )}