fix(map): show direct-heard SNR in node hover tooltip (#3925)#3929
Conversation
The map node-circle hover tooltip only rendered the node name and hop count; it never surfaced SNR, even when the node was heard directly (0 hops) and an SNR value was available. This was inconsistent with: - the Nodes list card view (`hopsAway === 0 && snr != null` -> 📶 X.XdB) - the position-history point tooltip fixed under #3590 Extract a pure `getMapHoverTooltipMeta(effectiveHops, snr)` helper in `nodeHops.ts` that decides whether to show the direct-heard SNR, and use it in the map hover tooltip so a "N hops · 📶 X.XdB" line is rendered when the node is heard directly and SNR is known. Adds `nodeHops.test.ts` covering the show/hide conditions (0 hops with SNR, SNR of 0, null/undefined SNR, multi-hop, unknown hops). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n
|
Claude finished @Yeraze's task —— View job PR Review: fix(map): show direct-heard SNR in node hover tooltip (#3925)Tasks:
Overall this is a clean, well-scoped fix. A few observations: Code Quality
The helper is well-factored — pure function, narrow interface, good JSDoc. One minor style note: line 105 uses a non-null assertion ( // line 105
return { hops, showSnr, snr: showSnr ? snr! : null };
// `snr!` is safe here because showSnr === true implies snr != null
The IIFE pattern Line 2296 uses Potential BugsNone found. The One edge case to be aware of (not introduced by this PR): PerformanceNo concerns. SecurityNo concerns. Test CoverageThe 7 tests in
One case not tested: The component-level rendering (NodesTab.tsx) lacks a snapshot/integration test for the tooltip HTML, but that's consistent with the rest of the test suite and isn't a blocker. SummarySolid fix with good test coverage and clean separation of concerns. The new pure helper is reusable and well-documented. The behavior table in the PR description matches the implementation. Approved. |
Summary
Fixes #3925. The map node-circle hover tooltip never displayed SNR, even when a node was heard directly (0 hops) and an SNR value was available. It only showed the node name and hop count.
This was a different code path from the position-history point tooltip (fixed in #3590) and inconsistent with the Nodes list card view, which both already show direct-heard SNR.
Changes
src/utils/nodeHops.ts— new pure helpergetMapHoverTooltipMeta(effectiveHops, snr)returning{ hops, showSnr, snr }. SNR is shown only wheneffectiveHops === 0 && snr != null, mirroring the Nodes card view and the position-history tooltip.src/components/NodesTab.tsx— the map marker hover<Tooltip>now uses the helper and renders aN hops · 📶 X.XdBline for directly-heard nodes with known SNR. Unknown-hop nodes with no SNR still render nothing (unchanged behavior).src/utils/nodeHops.test.ts— new unit tests for the helper: 0 hops with SNR, SNR of exactly 0, null/undefined SNR, multi-hop (SNR hidden), and unknown hops.Behavior
0 hops0 hops · 📶 X.XdB0 hops0 hopsN hopsN hops(unchanged)Testing
nodeHops.test.ts: 7 tests, all pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n