Hello-
I observed a somewhat unexpected behavior. Per documentation: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/control/updateview :
"This method will be called when any value in the property bag has changed. This includes field values". However, it seems the runtime is throttling/staging calls, and skip some calls within a timewindow.
I have a PCF bound to a field. In my form script, I have code
var myAttr = formContext.getAttribute('myfield'); myAttr.setValue("1"); myAttr.fireOnChange(); myAttr.setValue("2"); myAttr.fireOnChange(); myAttr.setValue("3"); myAttr.fireOnChange();
Then in my PCF I logged the attribute value inside updateView function.
I was expecting that I see all three values per control, because the fireOnChange should invoke all registered controls that bounded to the field and call the updateView.
I am only getting the value 3, but not 1 or 2.
That seems suggest the runtime somehow stage the call within a timewindow, and only invoke the last one and cancel previous ones. It's not uncommon to do this for performance reasons, but it does impact how client should write code if it is by design.
Anyone from PCF team can comment on that?
Thanks!
@jolake Thank you. It will be nice if the documetation can reflect that as well.
Great - I think this is pretty clear and makes total logical sense to me.
PCF will only call updateView when the backing data layer tells us there is new data for our property bag. Unfortunately, due to batching that occurs for updates of the data layer, if you do several changes like this in rapid succession they will likely end up batched, and thus your control may only get an updateView for some of the calls. This is by design, but you can be confident that whatever value PCF recieves will the most recent value.
Bump!
WarrenBelz
85
Most Valuable Professional
Michael E. Gernaey
65
Super User 2025 Season 1
mmbr1606
55
Super User 2025 Season 1