Skip to content

DRY: merge duplicated topic-edge lookup helpers #79

@lowhung

Description

@lowhung

Summary

Unify duplicate topic-edge lookup helpers in details panel into one directional lookup utility.

Why

find_source_node_for_topic and find_target_node_for_topic are mirrored traversals over the edge list. A single helper reduces branching duplication and future maintenance overhead.

Affected files

  • src/ui/panels.rs

Extraction plan

  • Introduce enum (Incoming/Outgoing) and helper like:
    find_connected_node_for_topic(graph, topic, direction, node_name) -> Option<String>
  • Replace both existing helper usages in Inputs/Outputs sections.
  • Remove redundant old helpers.
  • Add tests covering both directions and no-match behavior.

Risk

Low to medium. Touches edge-selection UX in details panel; incorrect direction mapping would break clickable topic navigation.

Acceptance criteria

  • Single directional helper replaces both lookup functions.
  • Clicking input/output topics still selects expected edge.
  • Tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions