flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Frontend] Fix memo-defeating props and per-mousemove state in CashflowProjectionChart

Open blurbeast opened this issue 2 weeks ago • 3 comments

Overview & Background

dashboard-view.tsx:895 builds the chart's streams prop as a fresh array of fresh objects on every render ([...snapshot.incomingStreams.map(...), ...snapshot.outgoingStreams.map(...)]), so all three useMemos in CashflowProjectionChart.tsx:9 recompute — including projectCashflow, a full daily-bucket projection over up to 365 points. Independently, onMouseMove calls setHovered on every mouse move, re-rendering the whole chart and rebuilding path strings at pointer speed. The component is not React.memo'd.


Technical Specification & Architecture

  1. Build the ProjectionStream[] in a useMemo keyed on snapshot (or React.memo the chart with a stable comparator).
  2. Throttle/requestAnimationFrame-defer the hover index update.

Target Files

  • frontend/src/components/dashboard/dashboard-view.tsx
  • frontend/src/components/dashboard/CashflowProjectionChart.tsx

Acceptance Criteria

  • [ ] The chart's memos do not recompute on unrelated dashboard renders.
  • [ ] Mouse-move updates do not re-render at pointer rate.
  • [ ] Measurable render-count reduction (e.g. React profiler) is demonstrated.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@samjay8 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

I can fix this

ℹ️ Repo Maintainers: To accept this application, review their application or assign @samjay8 to this issue.

samjay8 avatar Nov 20 '26 12:11 samjay8

Congratulations, @samjay8! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @samjay8: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 20 '26 12:11 drips-wave[bot]

This issue has been completed by @samjay8 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @samjay8: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 21 '26 14:11 drips-wave[bot]