问题
Following the openui5 tutorial with some deviations I get the following warning when I serve the dev version of the app:
Do not use synchronous controller creation for controller 'sap.ui.demo.walkthrough.controller.HelloPanel'! Use the new asynchronous factory 'sap.ui.core.mvc.Controller.create(...)' instead.
In webapp/view/App.view.xml the HelloPanel view is referenced as in the tutorial, that is with:
<mvc:XMLView viewName="sap.ui.demo.walkthrough.view.HelloPanel"/>
If I serve the production build generated with "npm run build:ui" I don't see this warning. If I change the code to boot from the CDN, I also do not see it.
I have updated the local UI5 installation to the same version as in the CDN (now 1.80) but that didn't help.
What is the reason for this warning? Also, is it something I should worry about?
回答1:
The constructor is implicitly called by the mvc:XMLView line above.
Class sap.ui.core.mvc.XMLView does not have its own settings but all those from the base class sap.ui.core.mvc.View may be used with the constructor.
Among them is "async" and setting it "true" removes the warning, like this:
<mvc:XMLView
viewName="sap.ui.demo.walkthrough.view.HelloPanel"
async="true"
/>
来源:https://stackoverflow.com/questions/63178520/warning-to-use-new-asynchronous-factory-sap-ui-core-mvc-controller-create