question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OData V4 error message on Select binding "Must not change a property before it has been read"

See original GitHub issue

OpenUI5 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:

  1. 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
  1. open http://localhost:8081/test/mockServer.html
  2. click on one of the activities, such as “Do something you love to do”
  3. navigation happens to the activity detail page hash is like #/activityDetail/('3')
  4. refresh the page to the activity detail page
  5. 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)

Step 1

Step 2

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:

https://github.wdf.sap.corp/I832513/ActivityListPOC/blob/dd8d7451b5a246daaf2430f00b3a598ec750f8d3/webapp/controller/ActivityDetail.controller.js#L14

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:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ThomasChadzelekcommented, Oct 2, 2019

Hello @codefactor !

I just learned that there is a property forceSelection of sap.m.Select which you should set to false. 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

0reactions
ThomasChadzelekcommented, Feb 24, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consuming OData V4 from SAPUI5 - Stack Overflow
The error: "must not change a property before it has been read" is understood to be CORS issue. Accepting Cross origin requests on...
Read more >
SAPUI5 OData v4 - How to change the model (property value)
Hi guys, I am a SAPUI5 Beginner and I have a problem which is ... What do I have to code to change...
Read more >
OData Operations - Documentation - Demo Kit - SAPUI5 SDK
When you call execute on the operation binding, the "change" action is executed with the selected business partner's navigation property BP_2_PRODUCT as binding...
Read more >
OData Version 4.01. Part 1: Protocol - OASIS Open
This document was last revised or approved by the OASIS Open Data Protocol ... entity, property, or error; for example whether a property...
Read more >
Navigation property under complex type - OData
Navigation under complex can have multiple bindings with different path. 2. Complex type does not have id, so the navigation link and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found