#Can `invoke`'s `onDone` decide the target state based on `output`?

1 messages · Page 1 of 1 (latest)

glacial moss
#

I'd like to have an invoked action (a fromPromise but I think it can be more general) that completes with an output.

The output should be consumable during invoke.onDone to choose which target to transition to. Ideally invoke.onDone could be a function that consumes context and output, then returns a transition. I think this is hard to evaluate in the stately visualizer, so it may be preferable to have invoke.onDone be an array of targets (as it can be today), but with the added ability for guards to consume output. AFAICT, the only thing in invoke.onDone that can consume output is an action.

Am I thinking about this wrong, or is this a feature request that makes sense?

#

Can invoke's onDone decide the target state based on output?

#

Also, semi-related: is there a concept of parallel output? If 2 states in a parallel state have reached their final child state, and both of those have outputs, what happens? where do the outputs go?

worn sky
#

Since transitions need to be deterministic, the best way to do this would be to either use guards or raise() an event onDone