fix(cli): address review feedback - remove redundant parse and fix filteredLabel guard

This commit is contained in:
Yaohua-Leo 2026-03-20 20:15:45 +08:00
parent 86c92cb4ce
commit e5d1ae72e6

View File

@ -342,11 +342,11 @@ export function registerNodesStatusCommands(nodes: Command) {
return true;
});
const liveNodes = parseNodeList(nodeListResult);
const livePairedNodes = liveNodes.filter((n) => n.paired);
const hasFilters = connectedOnly || sinceMs !== undefined;
const livePairedNodes = Array.from(liveNodesById.values()).filter((n) => n.paired);
const totalPairedCount = paired.length > 0 ? paired.length : livePairedNodes.length;
const filteredLabel =
filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : "";
hasFilters && filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : "";
defaultRuntime.log(
`Pending: ${pendingRows.length} · Paired: ${filteredPaired.length}${filteredLabel}`,
);