a tool for shared writing and social publishing

fix compound cursor logic

+6 -8
+3 -1
app/reader/getReaderFeed.ts
··· 36 36 .order("uri", { ascending: false }) 37 37 .limit(25); 38 38 if (cursor) { 39 - query = query.lt("indexed_at", cursor.timestamp).lte("uri", cursor.uri); 39 + query = query.or( 40 + `indexed_at.lt.${cursor.timestamp},and(indexed_at.eq.${cursor.timestamp},uri.lt.${cursor.uri})`, 41 + ); 40 42 } 41 43 let { data: feed, error } = await query; 42 44
+3 -7
app/reader/getSubscriptions.ts
··· 28 28 .eq("identity", auth_res.atp_did); 29 29 30 30 if (cursor) { 31 - query = query.lt("created_at", cursor.timestamp).lte("uri", cursor.uri); 31 + query = query.or( 32 + `created_at.lt.${cursor.timestamp},and(created_at.eq.${cursor.timestamp},uri.lt.${cursor.uri})`, 33 + ); 32 34 } 33 35 let { data: pubs, error } = await query; 34 - console.log(cursor); 35 36 36 - const actors: string[] = [ 37 - ...new Set( 38 - pubs?.map((pub) => pub.publications?.identity_did!).filter(Boolean) || [], 39 - ), 40 - ]; 41 37 const hydratedSubscriptions: PublicationSubscription[] = await Promise.all( 42 38 pubs?.map(async (pub) => { 43 39 let id = await idResolver.did.resolve(pub.publications?.identity_did!);