Allow consumer to register different versions of Auro components #526
Replies: 3 comments 2 replies
-
We can register a custom implementation of an auro component by using the exported import {registerComponent as registerButtonComponent} from '@aurodesignsystem/auro-button';
registerButtonComponent('auro-nls-button'); |
Beta Was this translation helpful? Give feedback.
-
@janabimustafa I want to keep this open. While we already support a solution you are looking for, I want to work with the header/footer to reduce, if not remove that naming collision. |
Beta Was this translation helpful? Give feedback.
-
Dropping this link here for reference. Shoelace.style has an interesting solution for avoiding registration collision that I want to see of we can apply to Auro. https://shoelace.style/getting-started/installation#avoiding-auto-registering-imports |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'd like to open a discussion around an enhancement that could significantly improve the development experience and flexibility for projects using Auro Components.
The Challenge
In our current workflow, when creating a new microsite, we often start by integrating the header/footer component. This component typically includes its own set of Auro Components, which may not always be the latest versions. These pre-included components are registered under
window.customElements
, which leads to a common issue: once a custom element is registered with a given name, it cannot be redefined or updated to a newer version within the same document. Consequently, this limits our ability to use updated versions of Auro Components within our microsites, potentially leading to inconsistency and outdated implementations across different parts of the UI.Proposed Solution
One potential solution to this challenge is to allow more flexibility in registering Auro Components under custom names, particularly for cases where version discrepancies occur. This approach would involve exposing the Auro Component classes directly, enabling clients (i.e., microsite developers) to register components under unique names within their own scope.
For example, if a microsite requires a more recent version of
auro-button
than what is provided by the header/footer component, the developer could register this updated version under a custom name, such aswindow.customElements.define("auro-mymicrosite-button", UpdatedAuroButtonClass)
. This would allow the microsite to utilize the latest version of the component without conflict with the version included in the header/footer.Benefits
Request for Alternatives and Feedback
While the above proposal outlines one possible route to addressing the versioning challenge with Auro Components, I am keen to explore alternative solutions and hear from the community. Your insights, experiences, and suggestions could be invaluable in shaping a comprehensive approach to this issue.
Thank you for considering this proposal. I look forward to a productive discussion and to collaboratively developing a solution that enhances the usability and versatility of Auro Components for all users.
Beta Was this translation helpful? Give feedback.
All reactions