OData V4 error message on Select binding "Must not change a property before it has been read"
See original GitHub issueOpenUI5 version: 1.65.1 (or greater)
Browser/version (+device/version): Chrome (any browser)
Any other tested browsers/devices(OK/FAIL): FAIL
URL (minimal example if possible): https://github.wdf.sap.corp/I832513/ActivityListPOC
User/password (if required and possible - do not post any confidential information here):
Steps to reproduce the problem:
- From command line on workspace directory execute the following script (or equivalent):
git clone https://github.wdf.sap.corp/I832513/ActivityListPOC.git
cd ActivityListPOC
npm install
npm run start:local
- open http://localhost:8081/test/mockServer.html
- click on one of the activities, such as “Do something you love to do”
- navigation happens to the activity detail page hash is like
#/activityDetail/('3')
- refresh the page to the activity detail page
- refresh again if the error does not happen
What is the expected result?
The page should load with the Activity Detail, with no error messages.
What happens instead?
The page successfully loads the Activity Detail, but there is an error dialog with the message Must not change a property before it has been read
Additionally the following console log can be observed:
2019-08-26 07:05:55.620064 Failed to update path /MDFEntityFactory_OneOnOneMeeting('B959E34EB22546FBA3A36DB70A92AE08')/activities('2')/statusId - Error: Must not change a property before it has been read
at constructor.ODataPropertyBinding.setValue (http://localhost:8081/resources/sap/ui/model/odata/v4/ODataPropertyBinding.js:691:22)
at constructor.PropertyBinding._setBoundValue (http://localhost:8081/resources/sap/ui/model/PropertyBinding.js?eval:118:9)
at constructor.PropertyBinding.setExternalValue (http://localhost:8081/resources/sap/ui/model/PropertyBinding.js?eval:223:17)
at eval (http://localhost:8081/resources/sap/ui/base/ManagedObject.js?eval:3616:22)
at eval (http://localhost:8081/resources/sap/ui/base/SyncPromise.js?eval:308:14)
at call (http://localhost:8081/resources/sap/ui/base/SyncPromise.js?eval:60:4)
at new SyncPromise (http://localhost:8081/resources/sap/ui/base/SyncPromise.js?eval:224:3)
at SyncPromise.then (http://localhost:8081/resources/sap/ui/base/SyncPromise.js?eval:307:7)
at fnClass.ManagedObject.updateModelProperty (http://localhost:8081/resources/sap/ui/base/ManagedObject.js?eval:3615:33)
at fnClass.ManagedObject.setProperty (http://localhost:8081/resources/sap/ui/base/ManagedObject.js?eval:1333:8) sap.ui.model.odata.v4.ODataPropertyBinding
Any other information? (attach screenshot if possible)
Here is a link to the View XML line where this property is bound: https://github.wdf.sap.corp/I832513/ActivityListPOC/blob/dd8d7451b5a246daaf2430f00b3a598ec750f8d3/webapp/view/ActivityDetail.view.xml#L18
Here is a snippet:
<Select
id="statusId"
selectedKey="{
path: 'activitylist>statusId'
}"
items="{
path: 'activitylist>/MDFGOVHEntityFactory_ActivityStatus',
templateShareable:true,
parameters: {
'$orderby': 'priority asc'
}
}">
<core:Item
key="{activitylist>internalId}"
text="{activitylist>statusName}" />
</Select>
The relative binding context for the activitylist
model for this tag is bound in the ActivityDetail.controller.js
in the following place:
Here is a copy:
this.getView().bindElement({
path: this.getOwnerComponent().getMeetingPath() + "/activities" + oEvent.getParameter("arguments").activityPath,
parameters: {
'$expand': 'status'
},
model: "activitylist"
});
Note that the error message is coming from the sap.ui.getCore().getMessageManager().getMessageModel()
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Hello @codefactor !
I just learned that there is a property
forceSelection
of sap.m.Select which you should set tofalse
. A quick test with your Snippix shows that the error is gone if you do so, but the selected key will be ignored.Best regards, Thomas
@dejavughost What should happen if you update a property before it has been read? Some say the update should be ignored. Some might say it should happen later - and use the ETag not known at the time of update? Doesn’t the counter the very idea of optimistic locking? I am not convinced.