Multiple components on the same page often make identical Horizon API calls independently. Deduplicating and batching these calls reduces API load and improves page performance.
Requirements and context
- Audit all Horizon API calls in the app
- Implement request deduplication: identical in-flight requests share a single promise
- Batch multiple address lookups (balance, federation) where Horizon supports it
- Cache responses with appropriate TTLs (balances: 30s, federation: 10min, events: 60s)
- Document expected API call reduction in PR
Suggested execution
git checkout -b perf/horizon-request-deduplication
- Create
src/lib/horizonClient.ts with deduplication and caching
- Replace direct Horizon calls with the client
- Write tests for deduplication and cache behaviour
Example commit message
perf: deduplicate and batch Horizon API calls across the app
Multiple components on the same page often make identical Horizon API calls independently. Deduplicating and batching these calls reduces API load and improves page performance.
Requirements and context
Suggested execution
src/lib/horizonClient.tswith deduplication and cachingExample commit message
perf: deduplicate and batch Horizon API calls across the app