Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-toolbar): update ToolbarRegistry to use metadata tag instead of class name #9607

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

dobrinyonkov
Copy link
Contributor

This change updates the registration mechanism for toolbar items to use a metadata tag instead of the class name.

Changes:

  • In Toolbar.ts, updated the getItemsInfo method to retrieve the registered toolbar item using ctor.getMetadata().getPureTag() instead of item.constructor.name.
  • In ToolbarRegistry.ts, modified the registerToolbarItem function to register items with ElementClass.getMetadata().getPureTag() instead of ElementClass.name.

Issue Addressed:

In production builds, webpack minifies class names which resulted in all toolbar buttons being registered under the same name ("i"). This caused all toolbar items to be registered as the last one registered due to name conflicts. By switching to a more stable identifier from the class metadata, we prevent such issues.

@dobrinyonkov dobrinyonkov merged commit c2e2c29 into main Aug 1, 2024
10 checks passed
@dobrinyonkov dobrinyonkov deleted the toolbar-registry-tagname branch August 1, 2024 13:19
dobrinyonkov added a commit that referenced this pull request Aug 5, 2024
…of class name (#9607)

This change updates the registration mechanism for toolbar items to use a metadata tag instead of the class name. 

#### Changes:
- In `Toolbar.ts`, updated the `getItemsInfo` method to retrieve the registered toolbar item using `ctor.getMetadata().getPureTag()` instead of `item.constructor.name`.
- In `ToolbarRegistry.ts`, modified the `registerToolbarItem` function to register items with `ElementClass.getMetadata().getPureTag()` instead of `ElementClass.name`.

#### Issue Addressed:
In production builds, webpack minifies class names which resulted in all toolbar buttons being registered under the same name ("i"). This caused all toolbar items to be registered as the last one registered due to name conflicts. By switching to a more stable identifier from the class metadata, we prevent such issues.
dobrinyonkov added a commit that referenced this pull request Aug 6, 2024
#9638)

This change updates the registration mechanism for toolbar items to use a metadata tag instead of the class name.

Changes:
In Toolbar.ts, updated the getItemsInfo method to retrieve the registered toolbar item using ctor.getMetadata().getPureTag() instead of item.constructor.name.
In ToolbarRegistry.ts, modified the registerToolbarItem function to register items with ElementClass.getMetadata().getPureTag() instead of ElementClass.name.
Issue Addressed:
In production builds, webpack minifies class names which resulted in all toolbar buttons being registered under the same name ("i"). This caused all toolbar items to be registered as the last one registered due to name conflicts. By switching to a more stable identifier from the class metadata, we prevent such issues.

Related to: #9607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants