Perspective Designer expression binding race condition with script transform (Expression binding timing out)

suppose I have a custom variable “cities” which returns a json array of 541 cities of the world (extracted from GitHub - lutangar/cities.json: Cities of the world in Json, based on GeoNames Gazetteer):


and a text label which fetches the first element of this array:

we experienced race conditions where the designer previews the first city name correctly,
while the browser shows an error message (below I highlighted designer preview and browser and the fact I am using incognito so no caching in the browser):

we have an idea of the reason why this happens however I was wondering whether this is a known bug which will be fixed soon or there’s some known limitation which will be documented.

Bindings do not work in order.
You are using an expression to trigger the binding. But since you only set it to “True”, both will only trigger once in a “random” order.
If you want the text to update when the other binding has finished with the script you will have to put a reference to that in the expression (or property).

I advice not to put an array like that in a binding script tho, there is no reason to it if it stays static.
Also you might consider putting it as a static custom session prop instead of on a view
It will up the performance and you wont have to worry it not being loaded yet for the other binding

1 Like

Ok, just wanted confirmation that expressions trigger once in random order when they are set to True.
This was of course an artificial example.
Thank you

1 Like