Skip to content

Fix live metrics change view and splits plots#469

Merged
cristian-tamblay merged 2 commits intodevelopfrom
fix/live-metrics-plot
Mar 10, 2026
Merged

Fix live metrics change view and splits plots#469
cristian-tamblay merged 2 commits intodevelopfrom
fix/live-metrics-plot

Conversation

@Felipedino
Copy link
Collaborator

This pull request optimizes the LiveMetricsChart component by improving how metric data is filtered and prepared for charting, and by making the WebSocket connection more configurable. The main changes involve using useMemo for performance, and updating the WebSocket URL construction to support custom API endpoints.

Performance improvements:

  • Refactored the filtering of metrics and the computation of chart data to use useMemo, ensuring these operations are only recalculated when their dependencies change, which improves rendering efficiency. [1] [2] [3]

Configuration and maintainability:

  • Changed the WebSocket URL construction to use the REACT_APP_API_URL environment variable, allowing the frontend to connect to a custom backend endpoint instead of always using the current window location.
image

Copilot AI review requested due to automatic review settings March 4, 2026 22:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the LiveMetricsChart React component to reduce unnecessary recalculation during renders and to allow the metrics WebSocket to connect to a configurable backend base URL (via REACT_APP_API_URL).

Changes:

  • Memoizes metric filtering and chart data preparation with useMemo to avoid recomputing on unrelated renders.
  • Refactors WebSocket URL construction to derive the WS base from REACT_APP_API_URL instead of window.location.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cristian-tamblay cristian-tamblay merged commit 937c246 into develop Mar 10, 2026
19 checks passed
@cristian-tamblay cristian-tamblay deleted the fix/live-metrics-plot branch March 10, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants