Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion python/ray/dashboard/client/src/pages/node/NodeRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,19 @@ export const WorkerRow = ({ node, worker }: WorkerRowProps) => {
<TableCell>
{/* Empty because workers do not have an expand / unexpand button. */}
</TableCell>
<TableCell align="center">{cmdline[0]}</TableCell>
<TableCell align="center">
<Link
component={RouterLink}
to={
coreWorker?.actorId &&
coreWorker.actorId !== "ffffffffffffffffffffffffffffffff"
? `/actors/${coreWorker.actorId}`
: `/cluster/nodes/${nodeId}`
}
>
{cmdline?.[0] || "Unknown Worker"}
</Link>
</TableCell>
Comment on lines +251 to +263
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Correctness & Maintainability Issues

  1. Defensive Programming: If cmdline is undefined or empty, accessing cmdline[0] can cause a runtime TypeError or render an empty, unclickable link, which is a poor user experience.
  2. Code Duplication: The <Link component={RouterLink} ...> wrapper is duplicated for both the actor and fallback paths. We can simplify this by inlining the conditional logic for the to prop and using a safe fallback for the link text.
      <TableCell align="center">
        <Link
          component={RouterLink}
          to={
            coreWorker &&
            coreWorker.actorId &&
            coreWorker.actorId !== "ffffffffffffffffffffffffffffffffffffffff" &&
            coreWorker.actorId !== "ffffffffffffffffffffffffffffffff"
              ? "/actors/" + coreWorker.actorId
              : "/cluster/nodes/" + nodeId
          }
        >
          {(cmdline && cmdline[0]) || "Worker (PID: " + pid + ")"}
        </Link>
      </TableCell>

<TableCell>
<StatusChip type="worker" status="ALIVE" />
</TableCell>
Expand Down
Loading