LHF: UpsChart deps array granular but fragile #15

Open
opened 2026-06-05 10:22:44 +00:00 by sebse · 0 comments
Owner

Low-Hanging Fruit

File: web/components/ChartCard/UpsChart.tsx

The usePlot deps array includes config.y_min, config.y_max, config.y_scale individually instead of just config:

[upsRows, config.y_min, config.y_max, config.y_scale, timeMode]

Impact

If other config properties change (e.g., title, series_limit), the chart does NOT rebuild — which is actually correct behavior. But if a new y-axis property is added to config, it must be manually added here.

Fix

Either use config directly (simpler, may cause unnecessary rebuilds on non-visual changes) or keep current granular approach. Current approach is fine.

Note

This is documentation only — current behavior is correct.

## Low-Hanging Fruit **File:** `web/components/ChartCard/UpsChart.tsx` The `usePlot` deps array includes `config.y_min`, `config.y_max`, `config.y_scale` individually instead of just `config`: ```tsx [upsRows, config.y_min, config.y_max, config.y_scale, timeMode] ``` ### Impact If other `config` properties change (e.g., `title`, `series_limit`), the chart does NOT rebuild — which is actually correct behavior. But if a new y-axis property is added to config, it must be manually added here. ### Fix Either use `config` directly (simpler, may cause unnecessary rebuilds on non-visual changes) or keep current granular approach. Current approach is fine. ### Note This is documentation only — current behavior is correct.
sebse added the low-hanging-fruit label 2026-06-05 10:22:44 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sebse/factorio-signal-exporter#15