by default, the value of external (to the JS query) variables is only read when the JS query is initially called. In order to refresh the value within the JS query itself, you need to check the
Keep variable references inside the query in sync with your app.
checkbox on the advanced tab of the query editor.
By @joeBumbaca in Rest api multiple query ( promise.all) - #4 by joeBumbaca