Skip to content

Clarify inline action vs regsitry based trigger gotcha #71

@gliechtenstein

Description

@gliechtenstein

In most cases, defining actions under $jason.head.actions and calling them via trigger is recommended.

This is because if we ever happen to pass around dynamic arguments, these template expressions may get instantiated on view render and will baked into the view.

For example, in the following case we want to display an alert with the local variable val at the time of user tap.

{
  "type": "label",
  "text": "push",
  "action": {
    "type": "$util.alert",
    "options": {
        "title": "value",
        "description": "{{$get.val}}"
    }
  }
}

However what actually happens is: this will get rendered at load time with the val value at the time of render. Then this action is not dynamic anymore because all its arguments have been instantiated. This is why it's recommended that you put all actions under head.actions so that these don't get instantiated at view render.

But this point can be confusing for people new to the framework.

So this issue is for figuring out how to deal with this problem. Could be through better documentation, could be through some sort of warning messages, something else, or all of the above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions