From 36f18d6e31a0ddb152f3045a509bbc17818a3c70 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Thu, 16 May 2024 20:37:15 -0700 Subject: [PATCH] skip transitiionn if we are already in the desired state --- transition.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transition.go b/transition.go index 2c50ce6..14422f0 100644 --- a/transition.go +++ b/transition.go @@ -25,6 +25,9 @@ func NewTransition(trigger string, source State, dest State) Transitioner { func (r *Transition) Run(m Modeler) error { currentState := m.InspectState() + if currentState == r.dest { + return nil + } if currentState == r.source || r.source == "*" { res := m.ChangeState(r.dest) if res == currentState {