Skip to content

@ui5/webcomponents-icons duplicate registry issues #1861

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

Closed
codefactor opened this issue Jun 23, 2020 · 1 comment · Fixed by #1869
Closed

@ui5/webcomponents-icons duplicate registry issues #1861

codefactor opened this issue Jun 23, 2020 · 1 comment · Fixed by #1869
Assignees
Labels

Comments

@codefactor
Copy link
Contributor

Describe the bug
If the page has, for whatever reason, loaded 2 versions of the UI5 web components, there will be 2 copies of the icon registry but only the first class that defined <ui5-icon> tag will "win" and the second duplicate version of <ui5-icon> will be ignored. This should be avoided, of course, for performance reasons - having 2 copies of the same Javascript code loaded on the page is undesirable; however, in some cases it will become unavoidable.

To reproduce
Steps to reproduce the behavior:

  1. Have a page which has 2 ui5 web components bundles loaded on the page
  2. Make sure that the first bundle does not include any icon registered, and make sure the second bundle has a few icons included
  3. Have the html reference a <ui5-icon> which references one of the icons that was included in the second bundle

Expected behavior
The icon registry should utilize some global variable to share the state between 2 copies of the same icon registry thus allowing all registered icons to be available to both copies, allowing the first copy of the <ui5-icon> class to utilize the registered icons from the second bundle.

Context

  • UI5 Web Components version: 0.21.4
  • OS/Platform: {...}
  • Browser (if relevant): {...}
  • Other information: {...}

Affected components (if known)

Icon

Log output / Any errors in the console

Icon.js:240 Required icon is not registered. You can either import the icon as a module in order to use it e.g. "@ui5/webcomponents-icons/dist/icons/shortcut.js", or setup a JSON build step and import "@ui5/webcomponents-icons/dist/Assets.js".
@codefactor
Copy link
Contributor Author

This happens for me locally whenever I use the @xweb/common-webcomponents imported as a local "file:../" in the package.json even if that dependency uses the exact same version of @ui5/webcomponents-icons

image

I have tried multiple approaches to use a local file copy of this library and nothing I do can prevent this dupe issue, ideally the above would have shown that the icon library was deduped and this issue wouldn't happen.

Once I am able to get my library released to a new version I should be able to solve this deduping issue locally, but I opened this issue to solve the icon issue - this dupe issue can and will happen in the future when the new UI5 Web Component Header is released to all SuccessFactors pages INCLUDING the 3rd part integrations in which customer Extensions are loaded on the page and those extensions might also include UI5 web components (though I don't know if that will actually happen or not).

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

Successfully merging a pull request may close this issue.

3 participants