Make a function run automatically
Problem
You want to build a real-time UI where your functions run automatically in response to input changes.
Solution
- In the Run panel, configure your function to run Automatically
- Use
{{ bindings }}
in your functions around all inputs you want to trigger an automatic re-run of your function.
Discussion
- Automatically run functions are most useful for querying or transforming data. For example, if you want to make a REST API Resource function which triggers automatically when select a Data Table row to load the data for a detail view, you can set the function to run Automatically and use a Path like this:
https://httpbin.org/get/{{ dataTable.selectedRow.id }}
- Avoid using Automatically run functions for mutative actions.
Known Limitations
- You may access properties of nodes in TypeScript Client functions without the surrounding
{{
and}}
, however when doing so these will not trigger functions to re-run as you might expect. Add the surrounding curly braces to listen to the result of the binding expression.