Skip to content

refactor(web_core)!: register basic catalog elements on render instead of on import - #2698

Open
josemontespg wants to merge 1 commit into
web-core-is-web-component-implementationfrom
web-core-basic-catalog-lazy-registration
Open

josemontespg wants to merge 1 commit into
web-core-is-web-component-implementationfrom
web-core-basic-catalog-lazy-registration

Conversation

@josemontespg

Copy link
Copy Markdown
Collaborator

Overview

Basic catalog components no longer call customElements.define as a side effect of being imported. Registration moves to render time: renderA2uiNode (in @a2ui/web_core and in the Lit renderer's own copy) calls registerUniversalElement for the implementation it is about to render.

Key changes

  • @a2ui/web_core/v0_9/basic_catalog
  • @a2ui/web_core/v0_9/universal
    • renderA2uiNode registers web component implementations (isWebComponentImplementationregisterUniversalElement) before emitting the tag.
  • @a2ui/lit
    • renderers/lit/src/v0_9/surface/render-a2ui-node.ts keeps its own renderA2uiNode and performs the same on-demand registration, so A2uiSurface is unchanged.
  • Tests
    • The 18 component suites register the basic catalog explicitly in before instead of relying on import side effects, and drop the now-dead dynamic imports.
    • render-a2ui-node.test.ts asserts the element is defined on first render.

@github-project-automation github-project-automation Bot moved this to Todo in A2UI Sep 18, 2026
@josemontespg
josemontespg force-pushed the web-core-basic-catalog-lazy-registration branch from bb17263 to 7b2aff6 Compare September 18, 2026 21:08

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread renderers/lit/src/v0_9/surface/render-a2ui-node.ts
Comment thread renderers/web_core/CHANGELOG.md
…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
josemontespg force-pushed the web-core-basic-catalog-lazy-registration branch from 21482ed to 6976a23 Compare September 21, 2026 19:20

This branch has not been deployed

No deployments
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.

1 participant