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 <dan.abramov@gmail.com>
zio/stable
Eric Bailey 2024-06-10 20:55:44 -05:00 committed by GitHub
parent 848151c4f9
commit 14cddb7ec0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

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.sort((a, b) => {
return (b.likeCount || 0) - (a.likeCount || 0)
})
return res.data
},
initialPageParam: undefined,