Skip to content

fix(angular): resolve universal element injectors per renderer - #4129

Merged
josemontespg merged 2 commits into
a2ui-project:mainfrom
josemontespg:angular-universal-google3-readiness
Nov 13, 2026
Merged

josemontespg merged 2 commits into
a2ui-project:mainfrom
josemontespg:angular-universal-google3-readiness

Conversation

@josemontespg

@josemontespg josemontespg commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

With useUniversalComponents, every catalog entry renders as a custom element that looks up the Angular Injector it needs when it connects. This PR fixes that lookup for pages with more than one renderer, and lets plain {...api, component} entries render inside universal containers.

An AngularWcHost now takes its own injector first. Then it tries the nearest ComponentHostComponent above it in the DOM, then the A2uiRendererService that owns its surface, and finally a stack of fallback injectors. Destroying one renderer no longer clears the fallback of another.

Breaking: with useUniversalComponents: true, plain {...api, component} entries now mount inside an <a2ui-ng-<name>> host element.

Changes

  • AngularCatalog adds tagName and element to plain {...api, component} entries, so universal containers can render them. Extensible entries are updated in place to keep their identity.
  • AngularWcHost resolves its injector from the DOM host, then the surface group, then the fallback stack. ComponentHostComponent and A2uiRendererService register their injectors for this lookup.
  • A2uiLitElement.adoptLightDomStyles caches scoped styles per element class instead of in inherited static fields, so a subclass registered under another tag gets its own sheet.

Verification

  • yarn --cwd typescript/core/web_core test and the Angular karma suite (ng test lib), with the new specs confirmed in the karma output.
  • yarn lint in both packages, the web_core and Angular builds, and ./scripts/fix_format.sh --check.

Part of #4148.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

josemontespg added a commit to josemontespg/A2UI-fork that referenced this pull request Nov 10, 2026
@josemontespg
josemontespg force-pushed the angular-universal-google3-readiness branch from 8adbb7e to daef762 Compare November 10, 2026 21:34
@josemontespg josemontespg changed the title feat(angular): prepare universal components for multi-renderer apps fix(angular): resolve universal element injectors per renderer Nov 10, 2026
@josemontespg
josemontespg force-pushed the angular-universal-google3-readiness branch from d71fe00 to abba9ea Compare November 11, 2026 22:02
@josemontespg
josemontespg requested a review from ditman November 11, 2026 22:13
@josemontespg
josemontespg marked this pull request as ready for review November 11, 2026 22:13

@ditman ditman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Thanks for marking the <a2ui-ng-<name>> wrapper change as a **BREAKING CHANGE**, that was my only comment!

@josemontespg
josemontespg force-pushed the angular-universal-google3-readiness branch from abba9ea to dc6790f Compare November 13, 2026 18:31
@josemontespg
josemontespg merged commit 7be54df into a2ui-project:main Nov 13, 2026
57 of 58 checks passed
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.

2 participants