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.

Being Able to React to Failed Service Metadata Request Sent by ODataModel Defined in App Descriptor

See original GitHub issue

This is more an enhancement request.

Motivation

Currently, the best practice is to set the ODataModel on the Component via the app descriptor (manifest.json) enabling preload and manifest first approach.

"models": {
  "myODataModel": {
    "dataSource": "mainService",
    "settings": {
      "preliminaryContext": true
    },
    "preload": true
}

Since the metadata is thus requested as early as possible, attaching a "metadataFailed" event handler in Component.js is often too late due to a race condition.

return UIComponent.extend("my.Component", {
  metadata: {
    manifest: "json"
  },

  init: function() {
      UIComponent.prototype.init.apply(this, arguments);
      this.getModel("myODataModel").attachMetadataFailed(/*...*/); // Too late ☹️
  },
});

Luckily, there is the API isMetadataLoadingFailed which can be leveraged to build a custom thenable method, but it would be more convenient if the framework could provide such a method out-of-the-box.

Similar request: https://github.com/SAP/openui5/issues/1399

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
uhlmannmcommented, Jun 19, 2020

As of SAPUI5 1.79 sap.ui.model.odata.v2.ODataModel#metadataLoaded has an optional parameter bRejectOnFailure. When set to true the returned promise will be rejected if the initial loading of the metadata fails. Hence closing this issue.

0reactions
uhlmannmcommented, May 19, 2020

@boghyon : Thank you for testing! I will close this issue when the functionality is shipped.

Best regards Mathias.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalidate Metadata Cache For OData Services - SAP Blogs
Firstly, open the manifest. json in the WebIDE, in Descriptor Editor Format. Navigate to Data Sources and click on the Sync Metadata Button....
Read more >
Odata service Metadata failed - sapui5 - Stack Overflow
I declared it in manifest and used it in controller. It works correct in my system. But it does not work correct in...
Read more >
Performance: Speed Up Your App - SAPUI5 SDK
Let's have a look at the most common issues that impact performance. Enable Asynchronous Loading. The first step of improving the performance of...
Read more >
SAPUI5: UI Development Toolkit for HTML5
have the same relationship in the service metadata. ... The OData model in SAPUI5 uses AJAX requests internally and the OData model ......
Read more >
Working With OData in ASP.NET Core - Pluralsight
Once the EDM has been defined, we need to register it. To do so, we should call into AddOData on the services collection...
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