Skip to content

[performance] Dead code carrying N+1/unbounded query patterns; client buffers full archive; avatars bypass next/image #390

Description

@TheExGenesis

Severity: Low

  • Dead code with the worst patterns (verified unused — delete before someone rewires it): threadUtils.ts:78-263 (recursive per-tweet N+1, unbounded .eq('conversation_id') silently capped at 1000 → truncated threads), tweet.ts getTweet, pgSearch.ts+SearchTweets.tsx, getStreamedTweetCountByDate (getTweetCountByDate.ts:34-94, client-side group of >1000-capped rows → wrong counts), getRecentUploadedAccounts.ts (no .limit(), 1000 rows for 7 avatars), getAccountMostMentionedAccounts, area-chart.tsx.
  • DownloadArchiveButton.tsx:9-31 does fetchblob()→objectURL, buffering a hundreds-of-MB archive in memory with no progress; a plain <a download> streams from storage.
  • Radix AvatarImage bypasses next/image (user-dir renders 50+/page).

Filed from a code-quality/security/performance/robustness review. File:line refs verified against main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance and scalabilitytech debtCode health, cleanup, maintainability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions