Skip to content

[Frontend] useTrade pagination: detail views miss trades beyond first page #224

Description

@ajitpratap0

Follow-up from PR #223 review.

useTrade(id) fetches the full trade list via apiClient.getTrades() (default limit=50) and filters client-side. Trades beyond the first page are invisible to detail views.

Options:

  1. Add a GET /api/v1/trades/:id backend endpoint (cleanest)
  2. Increase the limit to a higher value when fetching for single-trade lookup
  3. Share the query cache with useTrades so already-fetched pages are searched first

Also related: useTrades and useTrade use different query keys (['trades', limit, offset] vs ['trades', id]), so two hooks mounted simultaneously fire two full-list fetches. Consider sharing the base query or using queryClient.getQueryData to check the cache before fetching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendDashboard and UI issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions