I'm staring my UI5 with the following bootstrapping in index.js
:
sap.ui.define([
"sap/m/Shell",
"sap/ui/core/ComponentContainer"
], (Core, Shell, ComponentContainer) => {
"use strict";
new Shell("", {
app: new ComponentContainer("", {
height: "100%",
name: "webapp"
}),
appWidthLimited: false
}).placeAt("content");
});
According to the UI5 documentation:
Static dependencies are loaded in the dependency declaration array of the
sap.ui.define
call. These dependencies are always loaded in advance before executing the defined module.
Do I understand it correctly that in such case the modules will be always loaded in a synchronous way and there is no real way to avoid the «Synchronous XMLHttpRequest on the main thread» warning?
Can I, perhaps, just wrap new sap.m.Shell(sId?, mSettings?)
with async
/await
?
Update #1:
I've checked the loading with ?sap-ui-xx-nosync=warn
and got the following results:
For some reason i18n/i18n_en.properties
is loaded synchronously. The only place where I'm accessing the i18n
is:
const oBundle = myI18nModel.getResourceBundle();
But following the documentation, I could not grasp why myI18nModel.getResourceBundle()
leads to the synchronous loading.
Update #2:
After a deep exploration of no sync XHR sample, I found out the reason for the sync XHR
warning. That was "description": "{{appDescription}}"
and "title": "{{appTitle}}"
in manifest.json
which is explicitly noted:
"title": "Here the i18n bundles can't be loaded with 'async: true' yet!",
"description": "Same here. Hence, no 'i18n' in this 'sap.app' section!"
After replacing it with a static values the warning is gone.