From 14cddb7ec0a6088b5f2f89f61fc2a32656756f7a Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 10 Jun 2024 20:55:44 -0500 Subject: [PATCH] Sort profile feedgens by likes (#4380) * Sort profile feedgens by likes * Sort entire set as we get more pages * Nah This reverts commit 3b8714fd97bb113cfd8c588d5cdfd063d395f553. * Update profile-feedgens.ts --------- Co-authored-by: dan --- src/state/queries/profile-feedgens.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/state/queries/profile-feedgens.ts b/src/state/queries/profile-feedgens.ts index e2508f994e..8ad12ab611 100644 --- a/src/state/queries/profile-feedgens.ts +++ b/src/state/queries/profile-feedgens.ts @@ -3,7 +3,7 @@ import {InfiniteData, QueryKey, useInfiniteQuery} from '@tanstack/react-query' import {useAgent} from '#/state/session' -const PAGE_SIZE = 30 +const PAGE_SIZE = 50 type RQPageParam = string | undefined // TODO refactor invalidate on mutate? @@ -30,6 +30,9 @@ export function useProfileFeedgensQuery( limit: PAGE_SIZE, cursor: pageParam, }) + res.data.feeds.sort((a, b) => { + return (b.likeCount || 0) - (a.likeCount || 0) + }) return res.data }, initialPageParam: undefined,