Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify inline action vs regsitry based trigger gotcha #71

Open
gliechtenstein opened this issue Jul 26, 2017 · 0 comments
Open

Clarify inline action vs regsitry based trigger gotcha #71

gliechtenstein opened this issue Jul 26, 2017 · 0 comments

Comments

@gliechtenstein
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant