open-ux-tools
open-ux-tools copied to clipboard
BUG - App local previews fail with reuse libs added from annotation
Related Feature
#1924
Description
The library is only available in an abap backend, but if you use ui5-local you run everything offline. So, it can never find the lib.
You cannot add - name: sap.nw.core.gbt.notes.lib.reuse to the ui5-local yaml. If you remove it, then your app should start and run without the reuse component being loaded.
You would still see in the browser log a 404 when trying to load it but FEv4 should handle it
Steps to Reproduce
Steps to reproduce the behavior:
- Use https://github.tools.sap/ux/open-ux-tools-playground/tree/main/apps/fe.v4.lrop.note app
- Use YI3_TEST and service SB_NTE_DEMO_TP_OD_V4_UI > SD_NTE_DEMO_TP (0001) - OData V4
- Use example (mocked) metadata for testing: metadata.xml.zip.
- See failure to load local preview
Expected results
No failures during the previews.
Actual results
Previews with start, start-mock and start-variants-management are good, but previews with npm run start-local, npm run int-test and npm run start-noflp fail
Screenshots
If applicable, add screenshots to help explain the problem.
Version/Components/Environment
Add any other context about the problem here OS:
- [ ] Mac OS
- [ ] Windows
- [ ] Other
Root Cause Analysis
Problem
{describe the problem}
Fix
{describe the fix}
Why was it missed
{Some explanation why this issue might have been missed during normal development/testing cycle}
How can we avoid this
{if we don’t want to see this type of issues anymore what we should do to prevent}
@korotkovao. I looked at your PR #2134 again and the implementation feels wrong - not incorrect but just not the way it should be. So, I thought about it a little longer and realized what caused the feeling: the name is wrong. While the notes library is an SAP S/4 reuse library, from an application writer perspective, that term is meaningless.
These libs are actually customLibs i.e. libs that the app needs that are not part of the UI5 distribution. We don’t know anything about custom libs except their id e.g. we don’t know how and when to load them, therefore, the customLibs should never be part of the ui5Libs array and should never be added to the flpSandbox-preload or to any ui5*.yaml.
So, I’ recommend to simplify the implementation in #2134:
- ui5-application-writer: rename
ui5ReuseLibstocustomLibsorcustomUi5Libs - fiori-elements-writer: you add the notes lib only to customLibs but not to ui5Libs
- ui5-application-writer
- remove all coding regarding the
ui5ReuseLibs - modify the
manifest.jsontemplate at https://github.com/SAP/open-ux-tools/blob/main/packages/ui5-application-writer/templates/core/webapp/manifest.json#L39-L42 to something like:
- remove all coding regarding the
"libs": {<% ui5.ui5Libs.concat(ui5.customLibs ?? []).forEach((ui5Lib, idx, libs) => { %>
<%- `"${ui5Lib}": {}${idx+1 < libs.length ? ',' : ''}` %><% }); %>
}