Skip to content

Migrate remaining raw fetch calls to React Query for consistent loading, error, and caching #8

Description

@priscaenoch

Problem

The app already wires QueryClientProvider in src/main.tsx and uses useQuery in some components (e.g. AddressConnectionGraph.tsx, CircuitBreakerStatus.tsx, ContractDependencyGraph3D.tsx), but several pages fetch with raw fetch and manual useState/useEffect, giving inconsistent loading states, no caching, and duplicated error handling. Examples: src/pages/RpcMetricsDashboard.tsx, src/pages/RateLimitDashboard.tsx, src/pages/BatchMultiCall.tsx, src/pages/SetupPage.tsx.

What needs to be done

  • Convert the manual-fetch pages to useQuery/useMutation (reads vs. actions), using the shared API client.
  • Standardize loading and error UI via the query state (isLoading, error).
  • Configure sensible defaults (retry, staleTime) on the QueryClient where appropriate.

Files

  • src/main.tsx (query defaults)
  • src/pages/RpcMetricsDashboard.tsx, src/pages/RateLimitDashboard.tsx, src/pages/BatchMultiCall.tsx, src/pages/SetupPage.tsx

Acceptance deliverables

  • The listed pages use React Query for all reads/writes.
  • Loading and error states are derived from query state, not ad hoc flags.

Tests to pass

  • Tests for at least one converted page assert loading, success, and error rendering (with the API client mocked).
  • Existing tests continue to pass.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions