Skip to content

Use more useful fallback names in Map view too#1044

Closed
vpzomtrrfrt wants to merge 1 commit intomeshtastic:mainfrom
vpzomtrrfrt:feat/fallback-names-on-map
Closed

Use more useful fallback names in Map view too#1044
vpzomtrrfrt wants to merge 1 commit intomeshtastic:mainfrom
vpzomtrrfrt:feat/fallback-names-on-map

Conversation

@vpzomtrrfrt
Copy link
Copy Markdown

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

  • Added fallbackName use to NodeMarker rendering
  • Added fallbackName use to NodeDetail popup

Testing Done

Hovered over and clicked both named and unnamed nodes as a cursory validation of behaviour

Screenshots (if applicable)

Before:
image

After:
image

Checklist

  • Code follows project style guidelines - I can't find these
  • Documentation has been updated or added - n/a?
  • Tests have been added or updated - The map page doesn't have any tests as far as I can tell

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 14, 2026

@vpzomtrrfrt is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NodesLayer marker label/tooltipLabel to derive names from shortName or the node ID’s last 4 hex digits.
  • Updated NodeDetail popup display name to derive a fallback name using the same approach.
  • Added numberToHexUnpadded usage 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.

Comment on lines +30 to +34
const shortName = node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase();
const name =
node.user?.longName ??
t("fallbackName", {
last4: shortName,
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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,

Copilot uses AI. Check for mistakes.
Comment on lines +87 to +92
const shortName =
node.user?.shortName ?? numberToHexUnpadded(node.num).slice(-4).toUpperCase();
const longName =
node.user?.longName ??
t("fallbackName", {
last4: shortName,
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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,

Copilot uses AI. Check for mistakes.
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.

4 participants