This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix feed

+94 -29
.DS_Store

This is a binary file and will not be displayed.

+87 -29
app/src/app/api/bluesky/feed/route.ts
··· 91 91 92 92 // Fetch entries with IDs less than the cursor ID (older entries) 93 93 console.log(`Fetching entries older than ID ${beforeCursor}`); 94 + 95 + // Enhanced query for entries older than the cursor 94 96 const { data: entries, error } = await supabase 95 97 .from('flushing_records') 96 - .select(` 97 - id, 98 - uri, 99 - cid, 100 - did, 101 - text, 102 - emoji, 103 - created_at, 104 - handle 105 - `) 98 + .select('*') 106 99 .lt('id', beforeCursor) // Get entries older than cursor by ID 107 - .order('id', { ascending: false }) // Order by ID instead of created_at 100 + .order('id', { ascending: false }) // Order by ID to get newest first 108 101 .limit(MAX_ENTRIES); 109 102 110 103 if (error) { 111 104 throw new Error(`Supabase error: ${error.message}`); 105 + } 106 + 107 + console.log(`Found ${entries?.length || 0} older entries`); 108 + if (entries && entries.length > 0) { 109 + console.log(`Oldest ID in batch: ${entries[entries.length-1].id}, Newest ID in batch: ${entries[0].id}`); 112 110 } 113 111 114 112 // Process and return older entries (skip caching) ··· 248 246 ? `ID ${latestTimestampResult[0].id} at ${latestTimestampResult[0].created_at}` 249 247 : 'unknown'); 250 248 251 - // Try ordering by ID instead of created_at to see if it works better 252 - // This should work because IDs are auto-incrementing and higher IDs are newer 253 - const { data: entries, error } = await supabase 254 - .from('flushing_records') 255 - .select(` 256 - id, 257 - uri, 258 - cid, 259 - did, 260 - text, 261 - emoji, 262 - created_at, 263 - handle 264 - `) 265 - .order('id', { ascending: false }) // Changed to sort by ID instead of created_at 266 - .limit(MAX_ENTRIES); 249 + // Try multiple query approaches to ensure we get the most recent data 250 + console.log('Executing direct query to ensure we get the absolute latest data'); 267 251 268 - if (error) { 269 - throw new Error(`Supabase error: ${error.message}`); 252 + let entries; 253 + 254 + try { 255 + // First try: Get entries with highest IDs 256 + const { data: idSortedEntries, error: idSortError } = await supabase 257 + .from('flushing_records') 258 + .select('*') 259 + .order('id', { ascending: false }) 260 + .limit(MAX_ENTRIES); 261 + 262 + if (idSortError) { 263 + throw idSortError; 264 + } 265 + 266 + if (idSortedEntries && idSortedEntries.length > 0) { 267 + console.log('✅ ID-sorted query successful'); 268 + console.log(`ID-sorted query found entries with IDs: ${idSortedEntries.slice(0, 5).map(e => e.id).join(', ')}...`); 269 + entries = idSortedEntries; 270 + } else { 271 + console.warn('⚠️ ID-sorted query returned no entries'); 272 + } 273 + } catch (err) { 274 + console.error('❌ Error with ID-sorted query:', err); 270 275 } 276 + 277 + // If first query failed, try a different approach 278 + if (!entries) { 279 + try { 280 + // Second try: Get entries with newest timestamps 281 + const { data: timeSortedEntries, error: timeSortError } = await supabase 282 + .from('flushing_records') 283 + .select('*') 284 + .order('created_at', { ascending: false }) 285 + .limit(MAX_ENTRIES); 286 + 287 + if (timeSortError) { 288 + throw timeSortError; 289 + } 290 + 291 + if (timeSortedEntries && timeSortedEntries.length > 0) { 292 + console.log('✅ Time-sorted query successful'); 293 + console.log(`Time-sorted query found entries with IDs: ${timeSortedEntries.slice(0, 5).map(e => e.id).join(', ')}...`); 294 + entries = timeSortedEntries; 295 + } else { 296 + console.warn('⚠️ Time-sorted query returned no entries'); 297 + } 298 + } catch (err) { 299 + console.error('❌ Error with time-sorted query:', err); 300 + } 301 + } 302 + 303 + // If still no entries, try a last approach 304 + if (!entries) { 305 + console.log('⚠️ All previous queries failed, trying basic query'); 306 + const { data: basicEntries, error: basicError } = await supabase 307 + .from('flushing_records') 308 + .select('*') 309 + .limit(MAX_ENTRIES); 310 + 311 + if (basicError) { 312 + throw new Error(`Basic query error: ${basicError.message}`); 313 + } 314 + 315 + entries = basicEntries || []; 316 + } 317 + 318 + // Safety check 319 + if (!entries) { 320 + entries = []; 321 + } 322 + 323 + console.log(`Final query found ${entries.length} entries`); 324 + if (entries.length > 0) { 325 + console.log(`Highest ID: ${entries[0].id}, Latest timestamp: ${entries[0].created_at}`); 326 + } 327 + 328 + // Error already handled in the try/catch blocks above 271 329 272 330 console.log(`Retrieved ${entries?.length || 0} entries from database.`); 273 331
+7
app/src/app/page.tsx
··· 508 508 </div> 509 509 510 510 {error && <div className={styles.error}>{error}</div>} 511 + 512 + {/* Debug info (hidden in production) */} 513 + {entries && entries.length > 0 && ( 514 + <div className={styles.debugInfo} style={{ fontSize: '10px', color: '#666', margin: '5px 0', display: 'none' }}> 515 + <p>Debug: Latest entry ID: {entries[0].id}, Count: {entries.length}</p> 516 + </div> 517 + )} 511 518 512 519 {loading ? ( 513 520 <div className={styles.loadingContainer}>