You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.2 KiB

Decision 0005: Selection Source of Truth

Status: Accepted Date: 2026-05-03

Context

The composer derives its target from selected nodes. React Flow also has selection behavior, and the workflow store stores nodes with selected flags.

If both layers independently own selection, the composer can target the wrong node after canvas actions such as connection-drop creation.

Decision

The workflow store is the selection source of truth. React Flow selection is a UI mirror.

Implementation direction:

  • Add store actions such as selectSingleNode(nodeId) and clearSelection().
  • Use store actions after ConnectionDropMenu creates a new node.
  • Composer derives context from store nodes[].selected.
  • React Flow selection callbacks sync user selection into the store.

Rationale

The composer already reads workflow data from Zustand. Keeping selection there makes context derivation deterministic and testable.

Consequences

  • New downstream nodes created from connection drop must be selected through the store.
  • Tests should cover auto-select after creating image/video generation nodes.
  • Avoid local component-only selection fixes that bypass the store.