Ionosphere.tv
3
fork

Configure Feed

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

fix: use COALESCE for mention author profiles in SQL query

The m.* expansion shadowed the profile JOIN aliases for author_handle.
Use explicit column list with COALESCE(p.handle, m.author_handle) to
prefer cached profile data over the original fetch data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+12 -2
+12 -2
apps/ionosphere-appview/src/routes.ts
··· 282 282 const talkPlaceholders = talkUris.map(() => "?").join(","); 283 283 284 284 const topLevel = db.prepare( 285 - `SELECT m.*, p.handle as author_handle, p.display_name as author_display_name, p.avatar_url as author_avatar_url 285 + `SELECT m.uri, m.talk_uri, m.author_did, m.text, m.created_at, 286 + m.talk_offset_ms, m.byte_position, m.likes, m.reposts, m.replies, 287 + m.parent_uri, m.mention_type, m.indexed_at, 288 + COALESCE(p.handle, m.author_handle) as author_handle, 289 + p.display_name as author_display_name, 290 + p.avatar_url as author_avatar_url 286 291 FROM mentions m 287 292 LEFT JOIN profiles p ON m.author_did = p.did 288 293 WHERE m.talk_uri IN (${talkPlaceholders}) AND m.parent_uri IS NULL ··· 293 298 ).all(...talkUris); 294 299 295 300 const replyStmt = db.prepare( 296 - `SELECT m.*, p.handle as author_handle, p.display_name as author_display_name, p.avatar_url as author_avatar_url 301 + `SELECT m.uri, m.talk_uri, m.author_did, m.text, m.created_at, 302 + m.talk_offset_ms, m.byte_position, m.likes, m.reposts, m.replies, 303 + m.parent_uri, m.mention_type, m.indexed_at, 304 + COALESCE(p.handle, m.author_handle) as author_handle, 305 + p.display_name as author_display_name, 306 + p.avatar_url as author_avatar_url 297 307 FROM mentions m 298 308 LEFT JOIN profiles p ON m.author_did = p.did 299 309 WHERE m.parent_uri = ?