Hi!
I am experiencing an issue with the order of execution of the event handler actions of two views. The scenario is as follows:
I have two views in which I want to enable “Subscribe to updates” on the same data source. I do so in an action connected to the event “On view loaded”. I also want to disable “Subscribe to updates”, so I do so “On view unload”. This applies to both views.
The case is, when using this app solution and changing from one of these views to the other, the “On view loaded” of the new view will apply before the “On view unload” of the old view. I am assuming this is because the two actions are run in parallell, and the unload action is simply slower than the load action, but this causes the datasource to have “Subscribe to update” as false after the view has loaded, despite my intentions.
I have been able to solve this with a workaround by applying 200 ms sleep as an action “On view load” for both views, but this does not seem like an ideal solution.
I don’t understand why one would want “On view loaded” of one view to be able to occur before “On view unload” of another - perhaps someone could provide an argument for this? More importantly, if the order could be selected this would not have been an issue. Regardless, I am hoping to find a better solution than applying sleep to alter the order.