Skip to content

[BUG]: Portfolio floods RPC with ~23k requests during idle #106

Description

@rohans02

Bug Description

  • With a wallet connected and positions held, the portfolio page fires ~23,673 RPC requests over a 60-second idle window (no user interaction). This exhausts the public RPC's rate limit (429s + CORS blocks), which breaks the getLogs cost-basis scan, so P&L renders as -100%.

  • Root cause: useIndexedDB and its wrapper useFatePoolsStorage each return a fresh object literal every render. The portfolio effect that depends on storage sees a new identity each render, re-runs, sets state with a new array, and re-renders, looping indefinitely.

Steps to Reproduce

  1. Connect a wallet on Sepolia with at least one held position.
  2. Open /portfolio and leave it idle (no interaction).
  3. Open DevTools > Network, filter RPC: request count climbs into the thousands within 60 seconds.
  4. P&L shows -100% because the getLogs scan is rate-limited out.

Logs and Screenshots

Image

Environment Details

  • OS: Windows 11
  • Browser: Chrome / Brave
  • Next.js 15 static export, wagmi + viem
  • Chain: Sepolia (11155111), wallet connected, 3 held positions

Impact

High - Major feature is broken

Code of Conduct

  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions