Skip to content

Angular Renderer Resilience & Reactivity Updates#1939

Merged
gspencergoog merged 1 commit into
a2ui-project:mainfrom
vikramsanthalia:fix-angular-resilience
Jul 17, 2026
Merged

Angular Renderer Resilience & Reactivity Updates#1939
gspencergoog merged 1 commit into
a2ui-project:mainfrom
vikramsanthalia:fix-angular-resilience

Conversation

@vikramsanthalia

@vikramsanthalia vikramsanthalia commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request fixes critical reliability bugs and change-detection rendering skips in the Angular Renderer (ComponentHostComponent):

  1. Fix subscription memory leak: Resolves a pattern where the component-host subscribes to onSurfaceCreated and attempts to unsubscribe self-referentially within the synchronous emission path, which evaluates to undefined and leaks listeners.
  2. Asynchronous surface resolution: In progressive rendering or streaming environments, component host nodes can be mounted in the DOM before the surface itself is registered. Added a subscription to onSurfaceCreated to automatically bootstrap the component when the surface registers.
  3. Optimize reactivity (Signals upgrade): Upgraded componentType and props to Angular Signals. In strict OnPush applications, asynchronous updates inside RxJS callbacks were not recognized by the change detector, leaving components unrendered.

Pre-launch Checklist

@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 converts componentType and props to Angular Signals in ComponentHostComponent and introduces logic to wait for surface creation asynchronously if it is not immediately available. It also adds corresponding unit tests to verify these behaviors. The reviewer suggests refactoring the manual detectChanges() and Promise.resolve() change detection hacks by utilizing NgZone to handle asynchronous updates from outside the Angular Zone more idiomatically.

Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
@vikramsanthalia
vikramsanthalia force-pushed the fix-angular-resilience branch from 3b27e30 to bddff1c Compare July 7, 2026 07:06
@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Jul 8, 2026

@josemontespg josemontespg 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.

The changes make sense to improve reliability of Surface lookups during component tree creation. Left some comments about code style and testing

Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
@github-actions github-actions Bot removed the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Jul 16, 2026
@vikramsanthalia
vikramsanthalia force-pushed the fix-angular-resilience branch 2 times, most recently from deab4aa to 0b43cb9 Compare July 16, 2026 03:05
@vikramsanthalia

Copy link
Copy Markdown
Contributor Author

Hi @josemontespg,

I have resolved the conflicts by rebasing the branch on top of main (pulling in your Angular signals updates).

I've also:

  1. Replied to your review comments explaining the synchronous subscription emission edge case.
  2. Added the requested unit tests in component-host.component.spec.ts that verify that both surface creation and properties updates run inside the Angular zone via NgZone.run().

The PR checks are now green. Could you please take a look and merge the PR? Thanks!

Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
@vikramsanthalia
vikramsanthalia force-pushed the fix-angular-resilience branch from 0b43cb9 to 32ea9b5 Compare July 16, 2026 03:39
@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Jul 17, 2026
@vikramsanthalia
vikramsanthalia force-pushed the fix-angular-resilience branch 3 times, most recently from 57b43f0 to 632080f Compare July 17, 2026 16:08
This commit fixes critical reliability bugs and change-detection rendering skips in the Angular Renderer (ComponentHostComponent):

1. Fix subscription memory leak: Resolve a pattern where the component-host subscribes to onSurfaceCreated and attempts to unsubscribe self-referentially within the synchronous emission path, which evaluates to undefined and leaks listeners.
2. Asynchronous surface resolution: In progressive rendering or streaming environments, component host nodes can be mounted in the DOM before the surface itself is registered. Added a subscription to onSurfaceCreated to automatically bootstrap the component when the surface registers.
3. Optimize reactivity (Signals upgrade): Upgraded componentType and props to Signals. In strict OnPush applications, asynchronous updates inside RxJS callbacks were not recognized by the change detector, leaving components unrendered.
@vikramsanthalia
vikramsanthalia force-pushed the fix-angular-resilience branch from 632080f to 27f32b2 Compare July 17, 2026 16:42
@josemontespg
josemontespg enabled auto-merge (squash) July 17, 2026 17:05
@josemontespg
josemontespg disabled auto-merge July 17, 2026 17:05
@gspencergoog
gspencergoog enabled auto-merge (squash) July 17, 2026 17:17
@gspencergoog
gspencergoog disabled auto-merge July 17, 2026 17:19
@gspencergoog
gspencergoog merged commit 79fdf2a into a2ui-project:main Jul 17, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants