OpenUI5 version: <= 1.65.0
URL (minimal example if possible): https://embed.plnkr.co/IcOrLE/
Steps to reproduce the problem:
What is the expected result?
sap.ui.core.Fragment.load returns a Promise, it should load the fragments async.
What happens instead?
sap.ui.core.Fragment.load returns a Promise, however it load the fragments sync.
Any other information? (attach screenshot if possible)

_Fragment.load sync_

_Fragment.load sync requests_

_Fragment.load async (proposal)_

_Fragment.load async requests (proposal)_
Thank you for the detail report. This is known and on our backlog.
I was going to create a pull request, it seems it's not necessary... Here is my fix, just in case...
In Fragment.load, I've replaced return Promise.resolve(fragmentFactory(mParameters)) by return Promise.resolve(fragmentFactoryAsync(mParameters)).
Also, I've created these functions to load it async:
function fragmentFactoryAsync(vName, vType, oController) {
var mSettings = {};
if (typeof (vName) === "string") { // normal call
mSettings.fragmentName = vName;
mSettings.oController = oController;
mSettings.type = vType;
} else if (typeof (vName) === "object") { // advanced call with config object
mSettings = vName; // pass all config parameters to the implementation
if (vType) { // second parameter "vType" is in this case the optional Controller
mSettings.oController = vType;
}
} else {
Log.error("sap.ui.fragment() must be called with Fragment name or config object as first parameter, but is: " + vName);
}
if (vType === "XML") {
return loadFragmentXMLAsync(mSettings);
} else {
return new Fragment(mSettings);
}
}
function loadFragmentXMLAsync(mSettings) {
return XMLTemplateProcessor.loadTemplatePromise(mSettings.fragmentName, "fragment")
.then(function(documentElement) {
mSettings.fragmentContent = documentElement;
return new Fragment(mSettings);
});
}
To be honest, I don't remember exactly what kept us from implementing this together with the async factory method. In the past, we had some compatibility issues with internal apps that stumbled upon async view loading, e.g. in their integration tests. As we propagate the async flag from views to nested fragments, this might have been one issue.
In other words: I expect delays in reviewing a PR due to the compatibility questions. If you don't mind that, a PR would be appreciated.
[Update] I should mention that our backlog task not only targets the async loading of the fragment XML but also the async processing of its content (e.g. requiring controls and further fragments async). That's the tricky part reg. compatibility.
Quick update on this topic, since we had a couple of inquires in the last days and weeks:
We have just started working on this.
As @codeworrior mentioned, we aim for more than just the asynchronous behavior of the factory.
We also want to integrate the asynchronous loading of fragments into the regular XML processing workflow.
So fragments inside XMLViews, as well as nested Fragments are in our current scope.
We will update the Github issue once we got a commit done.
The documentation now states that Fragments are loaded asynchronously as of 1.84: https://openui5.hana.ondemand.com/topic/ccf76b76327c421e9d87ff7fc3d7ba41
Fixed by https://github.com/SAP/openui5/commit/1766288e137c40b85152c4225ac7c0f2a441353a and https://github.com/SAP/openui5/commit/7058c425404a92986f30f72245c4304d5961cb4c.
Most helpful comment
Quick update on this topic, since we had a couple of inquires in the last days and weeks:
We have just started working on this.
As @codeworrior mentioned, we aim for more than just the asynchronous behavior of the factory.
We also want to integrate the asynchronous loading of fragments into the regular XML processing workflow.
So fragments inside XMLViews, as well as nested Fragments are in our current scope.
We will update the Github issue once we got a commit done.