Add pagination to comments to prevent browser crash

Summary

Closes #720 (closed) - Fix browser crash with 1000+ comments

Changes

  • Limit initial render to 50 root-level comments (prevents browser crash)
  • Add "Show more comments" button for loading additional comments
  • Add visible pagination links for crawler accessibility (?comments_page=2&sort=trending#comments)
  • Create /api/comments/[author]/[permlink] route with in-memory caching (60s TTL)
  • Support URL-based navigation for bookmarkable/shareable comment pages

How It Works

  1. Browser users: Click "Show more" for smooth loading (no page reload)
  2. Crawlers: Follow visible <a href> links to discover all comments
  3. Direct URLs: ?comments_page=2 loads page 2 directly via SSR

Testing

API Investigation

Tested Hive APIs for native pagination - none available on public nodes:

  • database_api.list_comments - NOT available
  • get_content_replies - times out on large posts
  • bridge.get_discussion - works but returns all comments

Solution: Fetch all via get_discussion, cache on server, return paginated slices.

Edited by gandalf_automation

Merge request reports

Loading