[IGN-2420] Way to prevent script from running when popup view loads?

A View with a custom property, the property has a transform script, the transform script executes multiple times (3 times) each time the view loads.

Is there a way to block/prevent the script from running when the view initially loads?

Or a way to exit the script early until after the view is completely loaded?


I don't think there is a direct way, through scripting, to know when the view is (first loading or starting) and is done evaluating tags / running transform scripts

For now, I’m resorting to a bit of a hokey way to get around this by

  1. Writing the date and time to a property on the view (in the view’s onStartup event)

  2. In the transform script, compare property time to datetime.datetime.now() and if (3) seconds have not passed then exit the script.

If anyone knows of a cleaner/better way please let me know?

I don't really have an answer for you, however, this post might shed some light on what you're running into.

I would also suggest using the system.date.* functions as opposed to the datetime package.

1 Like

This is actually a different issue, most commonly encountered with expression bindings and/or chained bindings (a > b > c > d).

In these scenarios, any transform for d will evaluate as many times as there are links in the chain. This is because each of those properties initializes with an unknown value, then resolves its binding. That property now has a different value, and so any binding observing it will re-evaluate.

We do have a feature in-progress to reduce the thrash these sorts of bindings and transforms encounter, but modifying how bindings resolve is a very involved and delicate process, and there are also some other issues we need to resolve before we can reliably test it.

3 Likes

Has this issue been addressed yet?

Yes. Binding dependencies are automatically calculated and fired in a deterministic order to minimize extraneous firing since 8.1.21.

4 Likes