Skip to content

fix: register all themes in the web component bundles - #417

Merged
gkrajniak merged 2 commits into
mainfrom
fix/register-horizon-themes
Nov 18, 2026
Merged

gkrajniak merged 2 commits into
mainfrom
fix/register-horizon-themes

Conversation

@gkrajniak

@gkrajniak gkrajniak commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

What changed

  • mfp-wc-dashboard.js now imports @ui5/webcomponents/dist/generated/json-imports/Themes.js, so every theme UI5 ships is registered for @ui5/webcomponents, as it already is for @ui5/webcomponents-theming.
  • mfp-webcomponents.js now imports the theme registrations for @ui5/webcomponents-theming, @ui5/webcomponents and @ui5/webcomponents-fiori.
  • New e2e spec themes.e2e.ts switches the OpenUI5 theme to sap_horizon_dark, sap_horizon_hcb and sap_horizon_hcw, waits for the theme to apply, opens edit mode and the Edit Cards dialog, and fails on any "not registered for package" console error.

Why

  • Only the default sap_horizon was registered for @ui5/webcomponents in the dashboard bundle. In any other theme the console showed Theme [sap_horizon_dark] not registered for package [@ui5/webcomponents], and the "Edit Home" and action buttons and the Edit Cards dialog were not themed. The theme-loader registry is module-local in the bundle, so consumers cannot register the themes themselves.
  • A page that loads both bundles runs two UI5 Web Components runtimes that share the theme setting and the data-ui5-theme-properties stylesheet. mfp-webcomponents.js registered no themes, so on the first switch to sap_horizon_dark it fell back to sap_horizon, wrote the light values into the shared stylesheet tagged as sap_horizon_dark, and the dashboard runtime then skipped its own update. The cards stayed light until the theme was switched a second time.

Details

  • The dashboard bundle does not import @ui5/webcomponents-fiori themes: it contains no fiori components. mfp-webcomponents.js does, because it contains fiori components (for example the illustrated message).
  • The full @ui5/webcomponents/dist/Assets.js is not used: it also inlines all i18n and CLDR data and grows the dashboard bundle to 16.3 MB.
  • Verified in sap-ui-wc-playground (loads both bundles): the first switch to dark, and every following switch between Horizon, Dark, HCW and HCB, applies immediately with no theme warnings.

Bundle size

Bundle Raw before Raw after gzip before gzip after
mfp-wc-dashboard.js 1,819,159 B 2,720,920 B (+49.6%) 358,768 B 476,595 B (+32.8%)
mfp-webcomponents.js 4,090,636 B 5,934,115 B (+45.1%) 1,118,632 B 1,343,766 B (+20.1%)

Closes #416

## What changed

- `mfp-wc-dashboard.js` now imports `@ui5/webcomponents/dist/generated/json-imports/Themes.js`, so every theme UI5 ships is registered for `@ui5/webcomponents`, as it already is for `@ui5/webcomponents-theming`.
- New e2e spec `themes.e2e.ts` switches the OpenUI5 theme to `sap_horizon_dark`, `sap_horizon_hcb` and `sap_horizon_hcw`, waits for the theme to apply, opens edit mode and the Edit Cards dialog, and fails on any "not registered for package" console error.

## Why

Only the default `sap_horizon` was registered for `@ui5/webcomponents`. In any other theme the console showed `Theme [sap_horizon_dark] not registered for package [@ui5/webcomponents]`, and the "Edit Home" and action buttons and the Edit Cards dialog were not themed. The theme-loader registry is module-local in the bundle, so consumers cannot register the themes themselves.

## Details

- `@ui5/webcomponents-fiori` is not imported: the dashboard bundle contains no fiori components, so it never registers that package.
- The full `@ui5/webcomponents/dist/Assets.js` is not used: it also inlines all i18n and CLDR data and grows the bundle to 16.3 MB.
- Bundle size: 1,819,159 B → 2,720,920 B raw (+49.6%), 358,768 B → 476,595 B gzip (+32.8%).

On-behalf-of: @SAP grzegorz.krajniak@sap.com
Signed-off-by: gkrajniak <gkrajniak@gmail.com>
@gkrajniak
gkrajniak requested review from a team as code owners November 18, 2026 09:50
@gkrajniak gkrajniak self-assigned this Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed6f3131-4135-4dd1-8c8d-1ef1c84afe2d
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@gkrajniak gkrajniak moved this to In review in OpenMFP Development Nov 18, 2026
## What changed

`mfp-webcomponents.js` now imports the theme registrations for `@ui5/webcomponents-theming`, `@ui5/webcomponents` and `@ui5/webcomponents-fiori`, like `mfp-wc-dashboard.js` does.

## Why

A page that loads both bundles runs two UI5 Web Components runtimes that share the theme setting and the `data-ui5-theme-properties` stylesheet. `mfp-webcomponents.js` registered no themes, so on the first switch to `sap_horizon_dark` it fell back to `sap_horizon`, wrote the light values into the shared stylesheet tagged as `sap_horizon_dark`, and the dashboard runtime then skipped its own update. The cards stayed light until the theme was switched a second time.

## Details

- `@ui5/webcomponents-fiori` is included here because this bundle contains fiori components (for example the illustrated message).
- Bundle size: 4,090,636 B → 5,934,115 B raw (+45.1%), 1,118,632 B → 1,343,766 B gzip (+20.1%).

On-behalf-of: @SAP grzegorz.krajniak@sap.com
Signed-off-by: gkrajniak <gkrajniak@gmail.com>
@gkrajniak gkrajniak changed the title fix: register all themes for @ui5/webcomponents in the dashboard bundle fix: register all themes in the web component bundles Nov 18, 2026
@gkrajniak
gkrajniak merged commit e2e8761 into main Nov 18, 2026
8 checks passed
@gkrajniak
gkrajniak deleted the fix/register-horizon-themes branch November 18, 2026 10:02
@github-project-automation github-project-automation Bot moved this from In review to Done in OpenMFP Development Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Dashboard: non-default Horizon themes are not registered for @ui5/webcomponents

2 participants