Use more useful fallback names in Map view too#1044
Use more useful fallback names in Map view too#1044vpzomtrrfrt wants to merge 1 commit intomeshtastic:mainfrom
Conversation
|
@vpzomtrrfrt is attempting to deploy a commit to the Meshtastic Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Map page’s node marker labels/tooltips and the node detail popup to use the same “fallback name” strategy as the Nodes page, avoiding generic unknown.* labels for unnamed nodes.
Changes:
- Updated
NodesLayermarkerlabel/tooltipLabelto derive names fromshortNameor the node ID’s last 4 hex digits. - Updated
NodeDetailpopup display name to derive a fallback name using the same approach. - Added
numberToHexUnpaddedusage in Map components to generate consistent fallback identifiers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/web/src/components/PageComponents/Map/Popups/NodeDetail.tsx | Derives shortName from node ID when missing and uses fallbackName for display. |
| packages/web/src/components/PageComponents/Map/Layers/NodesLayer.tsx | Derives marker label/tooltip names using node ID last-4 hex fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const shortName = node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase(); | ||
| const name = | ||
| node.user?.longName ?? | ||
| t("fallbackName", { | ||
| last4: shortName, |
There was a problem hiding this comment.
t("fallbackName", { last4: shortName }) passes shortName, but when node.user?.shortName is set and longName is missing, shortName can be user-defined (not the hex last-4 of node.num). This can produce misleading names like "Meshtastic BOB" even though the placeholder is explicitly {{last4}}. Consider computing last4Hex from node.num (optionally padStart(4, "0")) and using that for the fallbackName interpolation; also consider falling back to node.user?.shortName before fallbackName for the display name.
| const shortName = node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase(); | |
| const name = | |
| node.user?.longName ?? | |
| t("fallbackName", { | |
| last4: shortName, | |
| const last4Hex = numberToHexUnpadded(node.num).slice(-4).toUpperCase().padStart(4, "0"); | |
| const shortName = node.user?.shortName ?? last4Hex; | |
| const name = | |
| node.user?.longName ?? | |
| node.user?.shortName ?? | |
| t("fallbackName", { | |
| last4: last4Hex, |
| const shortName = | ||
| node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase(); | ||
| const longName = | ||
| node.user?.longName ?? | ||
| t("fallbackName", { | ||
| last4: shortName, |
There was a problem hiding this comment.
longName is derived via t("fallbackName", { last4: shortName }), but shortName may be a user-specified short name rather than the hex last-4 of node.num (the translation uses {{last4}}). This can yield confusing tooltips when a node has a short name but no long name. Consider computing last4Hex from node.num and using that for fallbackName interpolation (and optionally keep shortName for the marker label).
| const shortName = | |
| node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase(); | |
| const longName = | |
| node.user?.longName ?? | |
| t("fallbackName", { | |
| last4: shortName, | |
| const last4Hex = numberToHexUnpadded(node.num).slice(-4).toUpperCase(); | |
| const shortName = node.user?.shortName ?? last4Hex; | |
| const longName = | |
| node.user?.longName ?? | |
| t("fallbackName", { | |
| last4: last4Hex, |
Description
Changed node popups on Map page to use fallbackName instead of unknown.shortName for nodes without explicit names, making them more consistent with the Nodes page.
Changes Made
Testing Done
Hovered over and clicked both named and unnamed nodes as a cursory validation of behaviour
Screenshots (if applicable)
Before:

After:

Checklist