diff --git a/packages/bsky/src/api/app/bsky/feed/getActorLikes.ts b/packages/bsky/src/api/app/bsky/feed/getActorLikes.ts index 0a1106ca7bf..ce6fa061e6f 100644 --- a/packages/bsky/src/api/app/bsky/feed/getActorLikes.ts +++ b/packages/bsky/src/api/app/bsky/feed/getActorLikes.ts @@ -1,3 +1,4 @@ +import { sql } from 'kysely' import { InvalidRequestError } from '@atproto/xrpc-server' import { Server } from '../../../../lexicon' import { QueryParams } from '../../../../lexicon/types/app/bsky/feed/getActorLikes' @@ -70,10 +71,10 @@ const skeleton = async ( let feedItemsQb = feedService .selectFeedItemQb() .innerJoin('like', 'like.subject', 'feed_item.uri') + .select(sql`coalesce("like"."indexedAt", "feed_item"."sortAt")`.as('sortAt')) .where('like.creator', '=', actorDid) - .orderBy('like.indexedAt', 'desc') - const keyset = new FeedKeyset(ref('feed_item.sortAt'), ref('feed_item.cid')) + const keyset = new FeedKeyset(ref('like.sortAt'), ref('feed_item.cid')) feedItemsQb = paginate(feedItemsQb, { limit,