Sort profile feedgens by likes

This commit is contained in:
Eric Bailey
2024-06-05 15:24:59 -05:00
parent 42477d8bbb
commit 0ff2dd446c
+4 -1
View File
@@ -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 = res.data.feeds.sort((a, b) => {
return (b.likeCount || 0) - (a.likeCount || 0)
})
return res.data
},
initialPageParam: undefined,