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.

Creating ComponentContainer with preloaded Component with manifest

See original GitHub issue

OpenUI5 version: 1.98.0 Browser/version (+device/version): Latest Chrome on Windows

I’m trying to programmatically load a Component (with manifest) into a ComponentContainer as described here: https://ui5.sap.com/#/topic/346599f0890d4dfaaa11c6b4ffa96312

	Component.load({
		name: "samples.components.sample",
	}).then(function(oComponent) {
		var oContainer = new ComponentContainer({
			component: oComponent
		});
		// ...
	});

However, I get the following error: Assertion failed: setAssociation(): sId must be a string, an instance of sap.ui.base.ManagedObject or null

I think the problem boils down to the component not being a component yet, but a function called “oClassProxy”, which doesn’t extend ManagedObject: https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/core/Component.js#L2865

Maybe the documentation just is a bit fuzzy here: If my component has a manifest, am I always supposed to use the “manifest first” mode?

When I just call the method, the component is loaded just fine:

	Component.load({
		name: "samples.components.sample",
	}).then(function(oComponent) {
		var oContainer = new ComponentContainer({
			component: oComponent()
		});
		// ...
	});

Thank you very much for your support in Improving the documentation!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Shtilianovacommented, Feb 4, 2022

Hello @LukasHeimann , Thank you for sharing this finding. I’ve created an internal incident 2280047493. The status of the issue will be updated here in GitHub. Regards, Diana

0reactions
stopcodercommented, Feb 18, 2022

Hi @LukasHeimann,

we adapted the documentation regarding Component.load and Component.create. The adaptation is already available in openui5 nightly build https://openui5nightly.hana.ondemand.com/topic/346599f0890d4dfaaa11c6b4ffa96312 and will be released with the upcoming version 1.99 as well.

Best regards, Jiawei

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using and Nesting Components - Documentation - SAPUI5 SDK
With the ComponentContainer you can nest components inside other components. ... Load and create the component asynchronously with "manifest first" mode by ...
Read more >
Async preload of libraries described in manifest file of the ...
So, my bootstrap uses data-sap-ui-async=true parameter. I expected that libriaries from manifest-file of my Component should loading ...
Read more >
When will Component.js be loaded? - sapui5 - Stack Overflow
In most cases, a Component is loaded with its descriptor ( manifest.json ) once the ComponentContainer is instantiated.
Read more >
Implementing Re-use Components in SAPUI5 libraries and ...
ui5.rootView setting of the manifest.json. We are going to make use of this. Firstly, we load our dialog from a fragment by using...
Read more >
Untitled
Components are independent and reusable parts used in SAPUI5 applications. ... consider that a faceless component can't be added to a ComponentContainer ....
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