Skip to content

Commit

Permalink
fix like count for odyssey (#95233)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangzj authored Oct 9, 2024
1 parent 90ab2fa commit b7ea02c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
isRequestingSitePost,
getPostsForQuery,
isRequestingPostsForQuery,
countPostLikes,
} from 'calypso/state/posts/selectors';
import { getSiteOption } from 'calypso/state/sites/selectors';
import {
Expand Down Expand Up @@ -98,6 +99,10 @@ export default function PostCardsGroup( {
getStatsTopPostsData( state, siteId, topPostsQuery )
);

const countLikes = useSelector(
( state ) => countPostLikes( state, siteId, topViewedPost?.id ) || 0
);

// Prepare the most popular post card.
const mostPopularPost = useSelector( ( state ) =>
getSitePost( state, siteId, topViewedPost?.id )
Expand All @@ -115,7 +120,7 @@ export default function PostCardsGroup( {
title: decodeEntities(
stripHTML( textTruncator( mostPopularPost?.title, POST_STATS_CARD_TITLE_LIMIT ) )
),
likeCount: mostPopularPost?.like_count,
likeCount: countLikes,
viewCount: mostPopularPostViewCount,
commentCount: mostPopularPost?.discussion?.comment_count,
};
Expand Down

0 comments on commit b7ea02c

Please sign in to comment.