Skip to content

Performance: Redundant API calls across components #95

@Mosas2000

Description

@Mosas2000

Summary

Multiple components independently fetch the same data from the blockchain:

  • Stats.tsx: Fetches all proposals to calculate statistics
  • ProposalList.tsx: Fetches all proposals to display them
  • UserDashboard.tsx: Fetches all proposals to find user's proposals

This means the same data is fetched 3 times on page load.

Recommended Fix

  1. Create a shared data fetching layer that caches results
  2. Use React Query or SWR for automatic caching and deduplication
  3. Fetch data once at the top level and pass down via context
  4. Implement a refresh strategy that updates all consumers

Impact

High - Tripling API calls wastes bandwidth, increases latency, and risks rate limiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendFrontend related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions