From e5bcf8c7ba0caf9d3c169539e1609f6567bbd70b Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Wed, 15 Oct 2025 18:09:26 -0400 Subject: [PATCH] fix compound cursor logic --- app/reader/getReaderFeed.ts | 4 +++- app/reader/getSubscriptions.ts | 10 +++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/reader/getReaderFeed.ts b/app/reader/getReaderFeed.ts index b390e08a..9cb7d2b0 100644 --- a/app/reader/getReaderFeed.ts +++ b/app/reader/getReaderFeed.ts @@ -36,7 +36,9 @@ export async function getReaderFeed( .order("uri", { ascending: false }) .limit(25); if (cursor) { - query = query.lt("indexed_at", cursor.timestamp).lte("uri", cursor.uri); + query = query.or( + `indexed_at.lt.${cursor.timestamp},and(indexed_at.eq.${cursor.timestamp},uri.lt.${cursor.uri})`, + ); } let { data: feed, error } = await query; diff --git a/app/reader/getSubscriptions.ts b/app/reader/getSubscriptions.ts index e13a5d4b..98f7934f 100644 --- a/app/reader/getSubscriptions.ts +++ b/app/reader/getSubscriptions.ts @@ -28,16 +28,12 @@ export async function getSubscriptions(cursor?: Cursor | null): Promise<{ .eq("identity", auth_res.atp_did); if (cursor) { - query = query.lt("created_at", cursor.timestamp).lte("uri", cursor.uri); + query = query.or( + `created_at.lt.${cursor.timestamp},and(created_at.eq.${cursor.timestamp},uri.lt.${cursor.uri})`, + ); } let { data: pubs, error } = await query; - console.log(cursor); - const actors: string[] = [ - ...new Set( - pubs?.map((pub) => pub.publications?.identity_did!).filter(Boolean) || [], - ), - ]; const hydratedSubscriptions: PublicationSubscription[] = await Promise.all( pubs?.map(async (pub) => { let id = await idResolver.did.resolve(pub.publications?.identity_did!); -- 2.51.2