Skip to content

fix(shell): bind reactive form controls by reference so Closure renaming can't break them - #237

Merged
jgindin merged 6 commits into
a2ui-project:mainfrom
mikzat:fix/closure-safe-form-controls
Sep 25, 2026
Merged

jgindin merged 6 commits into
a2ui-project:mainfrom
mikzat:fix/closure-safe-form-controls

Conversation

@mikzat

@mikzat mikzat commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Several templates looked up reactive form controls by string (formControlName="endpoint", form.get('endpoint')), while the controls themselves were created from unquoted object keys in fb.group({...}). That works with the Angular CLI build, but under Closure Compiler property renaming (used by the google3 build of Composer) those keys get renamed and the string lookup returns null. setUpControl then throws during the first change-detection pass, so the A2A agent configuration panel renders half-initialized (no labels, raw icon text, blank Connect button) until the user interacts with it.

This binds every field with [formControl]="form.controls.x" instead. That's plain property access, which the compiler renames consistently with the keys, and it's also type-checked against the form's shape.

  • AgentConfigPanel now creates a typed, non-nullable form at field initialization and applies its inputs in ngOnInit with setValue.
  • The add-renderer, add-API-key, and MCP server dialogs already had typed forms; their templates switch to [formControl] as well.

No behavior change in the Angular CLI build. Existing specs pass unchanged.

…ing can't break them

Templates looked up reactive form controls by string (formControlName="x",
form.get('x')), while the controls were created from unquoted object keys.
Under Closure Compiler property renaming those keys are renamed, the lookup
returns null, and setUpControl throws during the first change-detection pass,
leaving the A2A agent configuration panel half-rendered in optimized google3
builds.

Bind every field with [formControl]="form.controls.x" instead, which is plain
property access and is renamed consistently. The agent config panel now
creates a typed form at field initialization and applies its inputs in
ngOnInit. The add-renderer, add-API-key, and MCP server dialogs get the same
change.

@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 several Angular templates to bind form controls using [formControl]="form.controls.x" instead of formControlName="x" to prevent string-based lookups from breaking when JSCompiler renames keys. Additionally, AgentConfigPanel is updated to use a strongly-typed, non-nullable form group. Feedback suggests typing defaultBackendMode as A2aBackendMode instead of string to improve type safety and avoid unnecessary type assertions.

Narrow A2aBackendOption.id from string to A2aBackendMode so the agent config
form's backendMode control is typed end to end, which removes the cast on
save. With the form now non-nullable, drop the null fallback on tenantId and
update the spec that set it to null.
@mikzat
mikzat marked this pull request as ready for review September 25, 2026 02:29
@mikzat

mikzat commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@suyangw-g @jgindin this fixes a bunch of the closure compilations issues we're seeing in 1P when working with these dialogs.

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit e7a6294):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

…ject#119 card styling

The baseline committed with a2ui-project#119 does not match what the pinned Playwright
container renders for the A2A full chat view, so every PR based on main fails
visual-regression on this snapshot. Regenerated from the CI container output.
…nes workflow

Replaces the previous baseline with the one produced by the Visual Baselines
workflow (visual_baselines.yml) in the pinned Playwright container, per the
README instructions.
Adds the other snapshots the Visual Baselines workflow regenerated in the same
run, so the committed baselines match the pinned Playwright container output.
@jgindin
jgindin merged commit 398efe8 into a2ui-project:main Sep 25, 2026
12 of 13 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