Comment on page
This section contains common option definitions for action handlers.
Commonly used to assign action results to context fields.
Example 1: Direct assignment
Allow to assign value directly to
# assign value to context's `ctx` field `target`
# <assignTo> is action specific name and may generally can be either simply `assignTo` or more descrete `assignSomethingTo`
Example 2: Multi assignment
Then example above can also be written in the following way:
The main advantage of this alternative syntax is the ability to assign to multiple values and override the entire target object.
Let's say we want to save value into both
parameters, we can leverage that with:
Another example is with field override functionality.
Let assume we currently have the following context state:
and we want to assign to
ctx.somethingentirell new object:
# if override is not provided assigned value and existing will be merged
Another common usecase is to push some value into array.
# push some value to `ctx.something` field array
# if field is missing - it will be created with array and one pushed element in it
pushTocan push values into multiple targets, override original value.
But additionally to that there is one more option that works only when pushed value is array - pushing its items to the target array instead of the array itself:
# if children option is passed value's array items will be pushed to `target` array instead of pushing value itself