Forms not consistently reacting to updates in data property

I have an issue with the Form component not updating correctly when I pre populate the data property.

I’m using the Form component as a calculation tool. Each time it’s submitted, the entered data is saved to database together with calculation results. If the user wants to revisit earlier calculations they can load the data from earlier calculations into the form again, instead of starting from scratch.

I create a JSON object and load it into the data property of the form. I also do this on the cancel command, as I want to have the form prepopulated with default data after a reset.

Setting the default data from the cancel event works like a charm, but when I load the data from elsewhere the, such as from a change script on a custom property, the form only update occasionally. It seems to update with a data that was written second to last.

Example:
First I execute this: Form.data = {"key":valueA} and the form does not update.
Then I update the key Form.data = {"key":valueB}and the form updates to valueA

If if load the complete object into data (without getting the form updated) I can then touch any form entry field and all off the data get loaded into all fields.

It is like there is a update method on the form that does not get triggered correctly when the data is written externally, but does get called when the cancel event script is done.

Is there any exposed method that I can call to update/reload the form?

Does the data prop get updated correctly but not the corresponding form fields? Trying to get a better picture of your setup so the more info you provide the better I can try to reproduce on my end. I’ve setup a change script on a Custom Prop and it works but it is a super simple demo. Also, currently we don’t have an exposed method to update/reload the form.

@pamato Correct!
On the Form component I have script on onStartup and on onCancelActionPerfomed where is set the form data property by self.props.data = system.util.jsonDecode('{"...stuff...."}') which both seem to work fine.

On the form component I have a custom property loadedData that has a binding to a session property where I receive the JSON to load. loadedData has a change script writing the JSON to the form data property: self.props.data = currentValue.value

This all work as expected and the data property does get updated with the correct object structure.

The form has a couple for string entry fields, a dropdown, checkbox groups, and radio button groups.
In the case where the data is loaded without the entry fields getting updated, if I for example click a checkbox, then all data in the other fields get populated correctly as per the data object. So the data is all there, it just isn’t loaded into the fields.

If I test this in designer, running the form and loading the data according to the flow above, then the failing behavior is consistent - the fields never update by only populating the data property, but they do if I then change a filed or edit the data property manually in a single attribute.
When I test this in the bowser, the data is loaded into the session from another view from which I then navigate to the form, and in that case the behavior is inconsistent.

Dataflow:
self.session.custom.loadedData --binding--> Form.custom.loadedData –>
Form.custom.loadedData –-change script--> Form.props.data

If i in the designer update Form.custom.loadedData then the form will update every other change, as if the change gets in queue to be updated and then consumed when the next change happens.
If I in the designer update Form.props.data then form will update immediately