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
parent
848151c4f9
commit
14cddb7ec0
|
@ -3,7 +3,7 @@ import {InfiniteData, QueryKey, useInfiniteQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAgent} from '#/state/session'
|
import {useAgent} from '#/state/session'
|
||||||
|
|
||||||
const PAGE_SIZE = 30
|
const PAGE_SIZE = 50
|
||||||
type RQPageParam = string | undefined
|
type RQPageParam = string | undefined
|
||||||
|
|
||||||
// TODO refactor invalidate on mutate?
|
// TODO refactor invalidate on mutate?
|
||||||
|
@ -30,6 +30,9 @@ export function useProfileFeedgensQuery(
|
||||||
limit: PAGE_SIZE,
|
limit: PAGE_SIZE,
|
||||||
cursor: pageParam,
|
cursor: pageParam,
|
||||||
})
|
})
|
||||||
|
res.data.feeds.sort((a, b) => {
|
||||||
|
return (b.likeCount || 0) - (a.likeCount || 0)
|
||||||
|
})
|
||||||
return res.data
|
return res.data
|
||||||
},
|
},
|
||||||
initialPageParam: undefined,
|
initialPageParam: undefined,
|
||||||
|
|
Loading…
Reference in New Issue