There is a small bug with State Variables when used in modules. After initialization, regardless of what Type was chosen, the variable holds a string.
This can be easily tested like so:
-
Create new module
-
Add State Variable to new module and choose any type besides
string
-
Create an action that tries to use a function of the chosen type, for
Array
we’ll use.push()
-
Make function executable - be it as onInit trigger or trigger by button press
-
Now, when module is placed inside an app and the action is e executed, it will show these logs
Only after you manually assign the proper type, it will act as expected.
So if we change the content of the action to:
{{state.var}} = [];
{{actions.newAction2.trigger()}}
And in a second action, we check on the .push()
function again:
We’ll get: