Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/pretty-days-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sap-ux-private/preview-middleware-client': patch
'@sap-ux/preview-middleware': patch
---

fix: adjust fallback UI5 version
4 changes: 2 additions & 2 deletions packages/preview-middleware-client/src/utils/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export async function getUi5Version(library: string = 'sap.ui.core'): Promise<Ui
let version = versionInfo?.libraries?.find((lib) => lib.name === library)?.version;
const isCdn = versionInfo?.name === 'SAPUI5 Distribution';
if (!version) {
Log.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
version = '1.130.0';
Log.error('Could not get UI5 version of application. Using version: 1.130.9 as fallback.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems odd to have a hardcoded version here at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback is being used in case requesting the version from the UI5 sources does not work. So If you know of any other option than to hard code it... I'm open for suggestions. As discussed in #3557 (comment) using ui5-info does not seem to be one.

Copy link
Contributor

@IainSAP IainSAP Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui5-info does provide fallbacks but not patch version fallbacks. Why is a patch version necessary as a fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui5-info reads the UI5 version from UI5. So it is not a suitable fallback in case UI5 does not return a UI5 version (see #3557 (comment)).
Not sure why we need to discuss about who needs a patch version, but here we go:

version = '1.130.9';
await sendInfoCenterMessage({
title: { key: 'FLP_UI_VERSION_RETRIEVAL_FAILURE_TITLE' },
description: { key: 'FLP_UI_VERSION_RETRIEVAL_FAILURE_DESCRIPTION', params: [version] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ describe('ControllerExtension', () => {
expect(CommunicationService.sendAction).toHaveBeenCalledWith(
showInfoCenterMessage({
title: 'SAPUI5 Version Retrieval Failed',
description: 'Could not get the SAPUI5 version of the application. Using 1.130.0 as fallback.',
description: 'Could not get the SAPUI5 version of the application. Using 1.130.9 as fallback.',
type: MessageBarType.error
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe('FE V2 quick actions', () => {
actionName: 'add-controller-to-page',
telemetryEventIdentifier,
quickActionSteps: 2,
ui5Version: '1.130.0',
ui5Version: '1.130.9',
appType: 'fe-v2'
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ describe('utils/version', () => {
expect(version.patch).toEqual(11);
});

test('getUi5Version fallback to 1.130.0', async () => {
test('getUi5Version fallback to 1.130.9', async () => {
jest.spyOn(CommunicationService, 'sendAction');
const version = await getUi5Version();
expect(version.major).toEqual(1);
expect(version.minor).toEqual(130);
expect(CommunicationService.sendAction).toHaveBeenCalledWith(
showInfoCenterMessage({
title: 'SAPUI5 Version Retrieval Failed',
description: `Could not get the SAPUI5 version of the application. Using 1.130.0 as fallback.`,
description: `Could not get the SAPUI5 version of the application. Using 1.130.9 as fallback.`,
type: MessageBarType.error
})
);
Expand Down
6 changes: 3 additions & 3 deletions packages/preview-middleware/src/base/flp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,12 @@ export class FlpSandbox {
version = responseJson?.libraries?.find((lib) => lib.name === 'sap.ui.core')?.version;
isCdn = responseJson?.name === 'SAPUI5 Distribution';
} catch (error) {
this.logger.error(error);
this.logger.debug(error);
}
}
if (!version) {
this.logger.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
version = '1.130.0';
this.logger.error('Could not get UI5 version of application. Using version: 1.130.9 as fallback.');
version = '1.130.9';
isCdn = false;
}
const [major, minor, patch] = version.split('.').map((versionPart) => Number.parseInt(versionPart, 10));
Expand Down
Loading