How/when are the widgets values persisted?

In my session, some complex widgets are created dynamically.
For instance, when I want to load song number 30, I use a clone of a 'template' widget.
This template contains widgets with addresses like /30/title, /30/time etc, whose ids and addresses depend on its parent variables.

If I trigger the widget creation, can I immediately send some values to /30/title, even if Open Stage Control is still drawing the widgets?

Will the OSC listener be ready?

Another approach, that I use now, is to store everything in a big variable like {1: {"title":"bla"}, 30:{"title":"song30"}}, and to use /EDIT to alter this variable.
But it has some drawbacks and seem to trigger heavy redraws.

Do you have any advice @jean-emmanuel ?

Thx

Did you try ? Incoming messages are treated one after the other so yes.

Another approach [...] to use /EDIT to alter this variable.
But it has some drawbacks and seem to trigger heavy redraws.

Using /EDIT to modify dynamic variables does not trigger heavy redraws.

I had performance issues in the past when using a lot of @{widget} syntax for changing values or states of other widgets. Triggering that via a custom module (and OSC{} receive solved that).

During my tests I had some values disappearing, but maybe it was caused by other things.

not by itself, but if this variable is used by many widgets, and if I modify just a part of this variable, like {"30": "title"), will every widget depending on the variable be redrawn/recalculated?

if for example their values look like this:
@{/@{song_nb}/title}, this code will be evaluated on any change for any song, right?

Every widget will be redrawn only if uses this variables to define a non-dynamic property. Using an osc listener won't change that.

@{/@{song_nb}/title}, this code will be evaluated on any change for any song, right?

If that change modifies the value returned by this code, yes