-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
Issue with Global Custom Element Registry Updates Affecting Multiple Microfrontend Apps #2744
Comments
Can you expand on this:
This seems contrary to the concept of scoped elements. |
Hello @Westbrook, Thank you for your response. I apologize if my initial explanation was not clear. Let me elaborate on the issue we are facing with octa-icon and the concept of scoped elements. The core of our problem lies in the reusability of the octa-icon component across multiple microfrontends. Each microfrontend is intended to operate independently, potentially with different versions of octa-icon being used simultaneously. This is where the challenge arises. With the standard Custom Element Registry, once a custom element is defined, it is registered globally and cannot be redefined. This global registration is causing conflicts when different versions of octa-icon are needed for separate microfrontends. The @open-wc/scoped-elements approach allows for defining custom elements in a scoped manner, theoretically enabling the same element to be defined with variations within different scopes. However, our implementation experience has shown that while we can utilize scoped elements within a parent Lit element, we struggle to apply this scoping to independent components that are not encapsulated by a parent. Specifically, we cannot seem to define octa-icon with different scopes directly within our microfrontends. Here's what we are trying to achieve: Microfrontend A uses octa-icon v1.0 I hope this clarifies our situation. If you have any insights or suggestions on how we can overcome this hurdle, it would be greatly appreciated. |
That does help clarify what you're running into. If I understand correctly, while you have various micro-frontends, some of them are now encapsulated in their own shadow root. This would definitely point to a place where scoped custom element registries would not support the delivery of your content. If you are not able to encapsulate each micro-frontend in its own shadow root, then you would need more invasive techniques to allow for multiples of the same element on the page. This would involve changing the tag name of the elements that share the same DOM tree but not the same micro-frontend. We do not currently vend tools to support that, but if you are already shipping your code in a way that supports scoped element registries, then your consumers should be free to register their usage in a custom tag name. It's annoying, but without the encapsulation of shadow boundaries, I'm not sure what else could be done to support your use case. |
Cant you just wrap your microfrontend in a custom element? |
Hello,
We have encountered a challenge with our web application architecture and are seeking guidance or a potential solution.
Context:
Issue:
Attempted Solutions:
Request:
Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered: