Multiple onDone clauses with guard in invoke need to complete the same assign() function, how to do only one assign()? #4848
-
As shown in the example I have an invoke in a state that could result in two different onDone functions being called. In either case, I need to set the status on the context to the resulting output. The first clause has a guard that depends on this status being set. It seemed odd to create a state just to handle this routing to a target based on the status after assigning it. Is there a better way/pattern that I am missing in the examples repo or documentation? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The statechart definition does not (yet?) support "do this action, and then decide what to do", but it'd be interesting to think what that would look like. But also, if you think about this like a flowchart, this action would go on some explicit "diamond" (choice) state node, so it actually feels natural to have a "choice node" where this action lives that |
Beta Was this translation helpful? Give feedback.
The statechart definition does not (yet?) support "do this action, and then decide what to do", but it'd be interesting to think what that would look like.
But also, if you think about this like a flowchart, this action would go on some explicit "diamond" (choice) state node, so it actually feels natural to have a "choice node" where this action lives that
always
transitions to the right state based on some condition.