Skip to content

Analytics pieData recomputed on every render without memoization #201

Description

@martinzhames

Category: performance

Problem

In src/app/dashboard/analytics/page.tsx, pieData, totalVolume, and totalCount are recomputed via .map()/.reduce() directly in the component body on every render, feeding two separate ResponsiveContainer/chart instances, with no useMemo.

Impact

Recharts re-renders are relatively expensive (SVG re-layout); recomputing and re-rendering both charts on any unrelated parent re-render is wasted work.

Suggested fix

Wrap pieData/totalVolume/totalCount derivation in useMemo(() => ..., [stats]).

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions