UI5 sometimes throws error: Control with ID ... could not be found - EventProvider sap.m.routing.Target
UI5 sometimes throws error: Control with ID ... could not be found - EventProvider sap.m.routing.Target
随机地,登录 (SAP NetWeaver) 到 SAPUI5 页面后,SAPUI5 抛出错误 ID 为 rootControl 的控件 - EventProvider sap.m.routing.Target。我试图强制错误登录和注销。经过多次尝试(40 次,有时 102 次...),出现错误。
我的根控件是 App.view.xml
中的 <App id="rootControl">
。
manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "HomePage",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.6"
},
"ach": "CA-UI5-FST"
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"rootView": {
"viewName": "HomePage.view.App",
"type": "XML",
"async": true,
"id": "rootControl"
},
"dependencies": {
"minUI5Version": "1.30",
"libs": {
"sap.m": {},
"sap.ui.core": {}
}
},
"resources": {
"css": [
{
"uri": "css/customStyle.css"
}
]
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "HomePage.i18n.i18n"
}
},
"view": {
"type": "sap.ui.model.json.JSONModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay",
"defaultCountMode": "None",
"useBatch": false
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "HomePage.view",
"controlId": "rootControl",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"async": true
},
"routes": [{
"pattern": ":Layout:",
"name": "apphome",
"target": "home"
}, {
"name": "id",
"pattern": "Id/{Id}/:Layout:",
"target": "id"
}, {
"name": "details",
"pattern": "Details/{Details}/:Replace:",
"target": "details"
}],
"targets": {
"home": {
"viewId": "home",
"viewName": "Homepage",
"viewLevel": 1
},
"notFound": {
"viewId": "notFound",
"viewName": "NotFound",
"transition": "show"
},
"id": {
"viewId": "id",
"viewName": "Id",
"viewLevel": 2
},
"details": {
"viewId": "details",
"viewName": "Details",
"viewLevel": 3
}
}
}
}
}
有什么想法吗?
Randomly SAPUI5 throws error ...
我记得在过去的 UI5 版本中由于 竞争条件 而遇到同样的问题:
- 启动应用程序时,
Component.js
由于 sap.ui5/rootView/async: true
而异步检索根视图。
Component.js
中的init
通常会初始化路由器,该路由器检索与哈希值对应的目标视图,而根视图仍在加载。
- 有时,根视图无法在目标视图之前完全加载,这会导致错误 → 目标不知道将其视图放在哪里。
commit:d054bc1
确保目标等待根视图完全加载。
该修复程序随 1.54 一起发布,但根据更改日志,应该也可以在 1.52.5+ 中使用。
要查看应用程序是哪个 UI5 版本 运行,请按 Ctrl + Left Alt + Shift + P。请升级UI5 lib到最新稳定版
我不建议同步加载根视图。
随机地,登录 (SAP NetWeaver) 到 SAPUI5 页面后,SAPUI5 抛出错误 ID 为 rootControl 的控件 - EventProvider sap.m.routing.Target。我试图强制错误登录和注销。经过多次尝试(40 次,有时 102 次...),出现错误。
我的根控件是 App.view.xml
中的 <App id="rootControl">
。
manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "HomePage",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.6"
},
"ach": "CA-UI5-FST"
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"rootView": {
"viewName": "HomePage.view.App",
"type": "XML",
"async": true,
"id": "rootControl"
},
"dependencies": {
"minUI5Version": "1.30",
"libs": {
"sap.m": {},
"sap.ui.core": {}
}
},
"resources": {
"css": [
{
"uri": "css/customStyle.css"
}
]
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "HomePage.i18n.i18n"
}
},
"view": {
"type": "sap.ui.model.json.JSONModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay",
"defaultCountMode": "None",
"useBatch": false
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "HomePage.view",
"controlId": "rootControl",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"async": true
},
"routes": [{
"pattern": ":Layout:",
"name": "apphome",
"target": "home"
}, {
"name": "id",
"pattern": "Id/{Id}/:Layout:",
"target": "id"
}, {
"name": "details",
"pattern": "Details/{Details}/:Replace:",
"target": "details"
}],
"targets": {
"home": {
"viewId": "home",
"viewName": "Homepage",
"viewLevel": 1
},
"notFound": {
"viewId": "notFound",
"viewName": "NotFound",
"transition": "show"
},
"id": {
"viewId": "id",
"viewName": "Id",
"viewLevel": 2
},
"details": {
"viewId": "details",
"viewName": "Details",
"viewLevel": 3
}
}
}
}
}
有什么想法吗?
Randomly SAPUI5 throws error ...
我记得在过去的 UI5 版本中由于 竞争条件 而遇到同样的问题:
- 启动应用程序时,
Component.js
由于sap.ui5/rootView/async: true
而异步检索根视图。 Component.js
中的init
通常会初始化路由器,该路由器检索与哈希值对应的目标视图,而根视图仍在加载。- 有时,根视图无法在目标视图之前完全加载,这会导致错误 → 目标不知道将其视图放在哪里。
commit:d054bc1
确保目标等待根视图完全加载。
该修复程序随 1.54 一起发布,但根据更改日志,应该也可以在 1.52.5+ 中使用。
要查看应用程序是哪个 UI5 版本 运行,请按 Ctrl + Left Alt + Shift + P。请升级UI5 lib到最新稳定版
我不建议同步加载根视图。