Add check for undefined hopsAway (#616)

* Add check for undefined hopsAway

Better UI for already "fixed" #351

* Change conditional
This commit is contained in:
philon-
2025-05-12 17:54:06 +02:00
committed by GitHub
parent 3f933dd166
commit b2bb3baa01

View File

@@ -79,7 +79,6 @@ const NodesPage = (): JSX.Element => {
},
[hardware.myNodeNum],
);
return (
<>
<PageLayout
@@ -125,14 +124,14 @@ const NodesPage = (): JSX.Element => {
{node.user?.longName ?? numberToHexUnpadded(node.num)}
</h1>,
<Mono key="hops" className="w-16">
{node.lastHeard !== 0
? node.viaMqtt === false && node.hopsAway === 0
{node.hopsAway !== undefined
? node?.viaMqtt === false && node.hopsAway === 0
? "Direct"
: `${node.hopsAway?.toString()} ${
node.hopsAway ?? 0 > 1 ? "hops" : "hop"
} away`
: "-"}
{node.viaMqtt === true ? ", via MQTT" : ""}
{node?.viaMqtt === true ? ", via MQTT" : ""}
</Mono>,
<Mono key="lastHeard">
{node.lastHeard === 0