S4: Divider/UPS charts send null for irrelevant fields #9

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

Code Smell

File: web/components/ChartEditor.tsx

When chartType === divider or chartType === ups, the form still sends these fields as null in the POST body:

  • order_by, series_limit, y_min, y_max, y_scale, filter_combinators, filter_items, filter_items_exclude

For divider charts, all 8 fields are null. The POST handler inserts them as nullable columns. The PUT handler ignores them via COALESCE.

Why it matters

For every divider chart creation, the HTTP request payload carries ~200 bytes of null fields. While harmless functionally, its noisy in API logs and suggests the form doesnt understand its own domain.

Suggestion

Conditionally omit fields based on chartType in handleSave(). Or split the schema — but thats higher effort.

## Code Smell **File:** `web/components/ChartEditor.tsx` When `chartType === divider` or `chartType === ups`, the form still sends these fields as null in the POST body: - `order_by`, `series_limit`, `y_min`, `y_max`, `y_scale`, `filter_combinators`, `filter_items`, `filter_items_exclude` For divider charts, all 8 fields are null. The POST handler inserts them as nullable columns. The PUT handler ignores them via `COALESCE`. ### Why it matters For every divider chart creation, the HTTP request payload carries ~200 bytes of null fields. While harmless functionally, its noisy in API logs and suggests the form doesnt understand its own domain. ### Suggestion Conditionally omit fields based on `chartType` in `handleSave()`. Or split the schema — but thats higher effort.
sebse added the code-smell label 2026-06-05 10:22:08 +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#9