Embedded View + time.sleep

In my current project, as standard we create perspective views as frameworks, where later we create a main view with a few "Embedded View tool" that embed these frameworks.

The main view has a view parameter named "resource" where this parameter is passed through the URL.
The frameworks also have view parameter with the same name ("resource"), that must change its value based on the "resource" value on the URL. So, to summarize, the "resource" value is passed through the URL, to the main view, and from the main view to the embedded views, which should update the framework values.

However, when the page loads up, the frameworks does not update its values because it needs time for the main view to read the "resource" from the URL and update itself, and then pass the "resource" parameter to the embedded views, so they could also update. The framework only updates if I add a time.sleep on the framework scripts, because it waits for the "resource" to be received from the main view before running the script.

With all that said, my main question is that: Is there a better way to do it, without adding time.sleep to my scripts?

I apologize in advance for the long description, and appreciate all the help I can get to improve our system.

PS: I attached a picture below hoping it would make it clearer :slight_smile:

Untitled

Could try adding a view.custom.resource property and bind it to view.params.resource
Then add a change script to view.custom.resource that runs the script instead of using an onStartup event.

I use embedded views all the time on my perspective projects, and I don't think I've ever seen this issue. Just to be clear, you are using embedded views and not inline frames trying to point to a URL/page of that "framework" as you call it. You might want to show your property editor so that we can see your configuration of the embedded view with the path, params, and loading.order fields shown. (Speaking of which, do you have loading.order set to after-parent?

Ensure that the embedded view props property loading, order is set to after-parent (apologies, as Michael has mentioned above)

image

It also could be a persistence issue. If you have bindings in the props property params, you can also try to set it as persistent. Right click on the property with the binding and then and tick Persistent.
If you have binding inside your embed view, you can also check those bindings for persistence.

image

1 Like

Thanks for your help. I'll definitely try that!

Thanks for your time! Yup, all the loading props were set to "after-parent"

This fixed my problem. The persistent wasn't set. Thank you for your time!