State diagram: remove/hide leaves orphaned transition labels when stateDiagramEdgeLabelStyle node is set

0 votes
asked 11 hours ago in Bug by dmf19 (420 points)

With skinparam stateDiagramEdgeLabelStyle node, each transition label is drawn as its own small node between the two states. If one of those states is taken away with remove or hide, the label stays in the diagram. It hangs off the remaining state on an edge that leads nowhere.

@startuml
skinparam stateDiagramEdgeLabelStyle node

state Idle
state Charging
state Faulted $fault

Idle --> Charging : start
Charging --> Faulted : fault

remove $fault
@enduml

Expected: Idle → start → Charging, the same as the default label style gives. The Charging --> Faulted transition is gone completely, including its label.

Actual: Faulted is removed, but the fault label is still drawn below Charging, joined to it by a line that goes nowhere.

Removing the skinparam line gives the expected result, and hide $fault behaves the same as remove $fault. The problem shows up whenever you use tags to show part of a larger state machine: every transition leading to a removed state leaves its label behind.

The label node doesn't carry the tags of the transition's states, so remove/hide never matches it. A fix is to also drop a transition-label node once either of the states it connects has been removed or hidden.

Tested with 1.2026.9beta4.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...