The ability to chain multiple element actions together that run sequentially in order is great! The ability to use the result of the prior action through the $steps object is also powerful.
However, in instances where the actions are asynchronous, subsequent actions kick off immediately.
- In some cases, this is desired because you don’t care about the result of the prior action.
- In other cases, the subsequent action may be dependent on the prior action (e.g. updating a DB table, only if the prior action succeeded). In these instances, when the prior action is async, the $steps object is obviously not yet set because the promise is still pending meaning the function hasn’t returned.
When configuring actions in the Studio UI it would be great to be able to force waiting for the prior action to return/complete before the next action is run.
Currently working around this by adding a boolean action argument in the component registration that controls a wrapper function in the component logic and chooses whether to execute the actual target sync vs async. It feels common enough to be a core feature and would save a tonne of development time.