Skip to content

[Bug] Discover page makes ~200 RPC calls per load — add caching #89

@realproject7

Description

@realproject7

Bug

lib/ranking.ts calls get24hPriceChange() and getTokenTVL() for every candidate storyline (up to 50). Each function makes 2 on-chain reads, totaling ~200 RPC calls per discover page load. No caching layer exists.

Impact: Slow page loads, potential RPC rate limiting on Base Sepolia (and worse on mainnet with paid RPC).

Fix:

  • Add unstable_cache or revalidate (Next.js ISR) to the discover page server component
  • Consider a reasonable revalidation window (e.g., 60-300 seconds)
  • Alternatively, batch RPC calls using viem multicall to reduce round trips

Context: Introduced in PR #86. Both getTrendingStorylines() and getRisingStorylines() in lib/ranking.ts have this issue.

Checklist:

  • Add caching or ISR revalidation to discover page
  • Consider multicall for batching on-chain reads
  • npm run lint and npm run typecheck pass

Labels: bug, agent/T3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions