Skip to content

fix(meshcore): honor Temperature Unit on the DM telemetry graph (#3659)#3662

Merged
Yeraze merged 1 commit into
mainfrom
fix/3659-meshcore-telemetry-temp-unit
Jun 23, 2026
Merged

fix(meshcore): honor Temperature Unit on the DM telemetry graph (#3659)#3662
Yeraze merged 1 commit into
mainfrom
fix/3659-meshcore-telemetry-temp-unit

Conversation

@Yeraze

@Yeraze Yeraze commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #3659.

The per-node telemetry graph on the MeshCore Direct Messages page always showed temperature in Celsius regardless of the user's Temperature Unit setting. Root cause: it mounted <TelemetryGraphs nodeId=… baseUrl=… /> without the temperatureUnit prop, which defaults to 'C'.

TelemetryGraphs already does the conversion (via formatTemperature), and both the Meshtastic DM view (MessagesTab.tsx) and the MeshCore Telemetry dashboard (MeshCoreTelemetryView.tsx) already pass temperatureUnit — only this one call site was missing it.

Fix

Pass temperatureUnit and telemetryVisualizationHours from useSettings() into the DM-page TelemetryGraphs, mirroring MessagesTab. Axis label + tooltip now reflect °F/°C per the setting.

Testing

  • Extended MeshCoreDirectMessagesView.test.tsx — asserts the graph receives temperatureUnit and the telemetry hours from settings (12 tests pass).
  • tsc clean.

🤖 Generated with Claude Code

The per-node telemetry graph on the MeshCore Direct Messages page rendered
temperature in Celsius regardless of the user's Temperature Unit setting,
because it mounted <TelemetryGraphs> without the `temperatureUnit` prop (which
defaults to 'C'). TelemetryGraphs already performs the conversion — the
Meshtastic DM view and the MeshCore Telemetry dashboard already pass it; only
this call site was missing it.

Pass `temperatureUnit` and `telemetryVisualizationHours` from useSettings,
mirroring MessagesTab. Axis label and tooltip now reflect °F/°C per the setting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Claude finished @Yeraze's task —— View job


PR Review: fix(meshcore): honor Temperature Unit on the DM telemetry graph

  • Gather context
  • Read changed files
  • Review implementation
  • Review test coverage
  • Post findings

Summary

This is a clean, minimal, and correct fix. The root cause was clearly identified and the solution mirrors the existing pattern used in MessagesTab.tsx and MeshCoreTelemetryView.tsx.

Implementation (MeshCoreDirectMessagesView.tsx)

No issues. The fix correctly:

  • Destructures temperatureUnit and telemetryVisualizationHours from useSettings() (line 67)
  • Passes them as temperatureUnit and telemetryHours to <TelemetryGraphs> (lines 422–423)
  • Matches the prop names on TelemetryGraphsProps (temperatureUnit?: TemperatureUnit, telemetryHours?: number) — the defaults in TelemetryGraphs are 'C' and 24, so without this fix users with °F or custom hour settings were silently getting wrong values

The added comment (lines 64–67) is clear and references the issue number, which is good for future maintainers.

Test Coverage (MeshCoreDirectMessagesView.test.tsx)

Well done. The key addition is the assertion in the existing 'mounts the TelemetryGraphs component...' test (lines 199–201):

expect(graphs.getAttribute('data-temp-unit')).toBe('F');
expect(graphs.getAttribute('data-telemetry-hours')).toBe('48');

The mock for useSettings returns temperatureUnit: 'F' and telemetryVisualizationHours: 48 (line 27), so these assertions directly verify the regression is fixed. The stub for TelemetryGraphs (lines 39–49) correctly captures both new props.

No new tests were needed beyond extending the existing mount test — this is the right call since the other tests (no-sourceId, prefix-key guard) already cover the gating logic.

Minor Observations (non-blocking)

  1. telemetryVisualizationHours default in useSettings mock: The mock returns 48, which is a non-default value. This is deliberate and good — using the default (24) would make the test pass even if the prop were hardcoded. Using 48 ensures the setting is actually wired through.

  2. No Fahrenheit default test: There's no test that verifies the absence of temperatureUnit would fall back to 'C' (which is the TelemetryGraphs default). But this is already covered by TelemetryGraphs's own test suite and isn't the responsibility of this component's tests.

  3. data-telemetry-hours attribute type: The test asserts .toBe('48') (string) because HTML attributes are strings. The stub uses props.telemetryHours ?? '' which would give '0' if telemetryHours were 0 — not a real-world issue but a subtle edge case in the stub only.

Verdict

Approved. Small, focused, correct fix with appropriate test coverage. No bugs, no security concerns, no performance issues. Ready to merge.


@Yeraze Yeraze merged commit da1ad11 into main Jun 23, 2026
19 checks passed
@Yeraze Yeraze deleted the fix/3659-meshcore-telemetry-temp-unit branch June 23, 2026 02:54
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.

MeshCore telemetry: convert temperature to user's Temperature Unit setting

1 participant