openui5: `sap.ui.core.IAsyncContentCreation` leads to "Cannot read properties of null (reading `getId`)" on `Fragment` loading

OpenUI5 version: 1.95

Browser/version (+device/version): Chrome DEV

I’m trying to adopt recently introduced sap.ui.core.IAsyncContentCreation:

metadata: {
	interfaces: [
		"sap.ui.core.IAsyncContentCreation"
	],
	manifest: "json"
},

But once I’ve added sap.ui.core.IAsyncContentCreation, I face an issue with loading a Fragment:

27_002439

I’ve checked deeper and found out, that the problem is with oView, which is simply null:

this._oDialog = await Fragment.load({
	controller: fragmentController,
	id: oView.getId(),
	name: "webapp.view.AuthDialog"
});

The place where this._oView is initialized:

constructor: function constructor(oView) {
	this._oView = oView;
}

I assume, that the problem is that the system has not enough time to load and initialize oView.getId() due to async nature introduced by sap.ui.core.IAsyncContentCreation. I’ve tried to force waiting for the oView with async/await, but it didn’t work. Once I remove sap.ui.core.IAsyncContentCreation, everything is working correctly but in a sync way.

My question is: How to tell UI5 to wait until the Fragment is loaded if using sap.ui.core.IAsyncContentCreation?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30 (14 by maintainers)

Most upvoted comments

Hi @pubmikeb,

the sync loading of the i18n file of a component is now replaced by an asynchronous request with change ad5cf65. This will be available with UI5 version 1.121 and upwards.

Best regards, Jiawei

@pubmikeb About the remaining sync XHR calls, here I documented what I’m currently aware of: https://blogs.sap.com/2018/04/26/ui5ers-buzz-29-asynchronify-your-app/comment-page-1/#comment-545788

The CLDR is one of them.

Hi @pubmikeb,

I recently stumbled upon this again, and yes there is indeed an update now. We are currently fixing another issue wrt. synchronous ResourceBundle loading.

In the wake of UI5 2.0 we will have to address this too. Not sure when though… still, the issue came up again and needs to be fixed before the 2.0 release.

BR, T