refactor(web_core)!: register basic catalog elements on render instead of on import - #2698
Open
josemontespg wants to merge 1 commit into
Conversation
josemontespg
force-pushed
the
web-core-basic-catalog-lazy-registration
branch
from
September 18, 2026 21:08
bb17263 to
7b2aff6
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors basic catalog components to register their custom elements on first render via renderA2uiNode rather than as a side effect of being imported. Corresponding updates were made to tests and component exports. The reviewer noted a structural discrepancy between the Lit and @a2ui/web_core implementations of renderA2uiNode that should be aligned, and pointed out a placeholder PR reference in the changelog that needs to be updated.
josemontespg
added this pull request to stack #2699
September 18, 2026 21:09
josemontespg
force-pushed
the
web-core-basic-catalog-lazy-registration
branch
from
September 18, 2026 21:40
7b2aff6 to
21482ed
Compare
…d of on import Basic catalog components no longer call `customElements.define` as a side effect of being imported. The element classes are module-private; only the `WebComponentImplementation` constants are exported, and `renderA2uiNode` (in web_core and in the Lit renderer) registers the element it is about to render.
josemontespg
force-pushed
the
web-core-basic-catalog-lazy-registration
branch
from
September 21, 2026 19:20
21482ed to
6976a23
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Basic catalog components no longer call
customElements.defineas a side effect of being imported. Registration moves to render time:renderA2uiNode(in@a2ui/web_coreand in the Lit renderer's own copy) callsregisterUniversalElementfor the implementation it is about to render.Key changes
@a2ui/web_core/v0_9/basic_catalog@customElement(...). The element classes andBasicCatalogA2uiLitElementare module-private; only theWebComponentImplementationconstants (A2uiCard,A2uiButton, ...) are exported fromcomponents/index.ts.registerUniversalElement(added in feat(web_core)!: addelementto WebComponentImplementation and element registration helpers #2596).@a2ui/web_core/v0_9/universalrenderA2uiNoderegisters web component implementations (isWebComponentImplementation→registerUniversalElement) before emitting the tag.@a2ui/litrenderers/lit/src/v0_9/surface/render-a2ui-node.tskeeps its ownrenderA2uiNodeand performs the same on-demand registration, soA2uiSurfaceis unchanged.beforeinstead of relying on import side effects, and drop the now-dead dynamic imports.render-a2ui-node.test.tsasserts the element is defined on first render.