Skip to content

client: avoid necessary network requests and fix focus loss#984

Merged
nan-yu merged 3 commits intogoogle:mainfrom
nan-yu:client
Mar 25, 2026
Merged

client: avoid necessary network requests and fix focus loss#984
nan-yu merged 3 commits intogoogle:mainfrom
nan-yu:client

Conversation

@nan-yu
Copy link
Copy Markdown
Collaborator

@nan-yu nan-yu commented Mar 25, 2026

Description

The v0.8 Angular renderer's TextField and other input components were hardcoded to dispatch every input event as a server action, so local updates were also sent to the server. The MessageProcessor lacks a mechanism to distinguish between local state updates and global agent actions. This PR updates MessageProcessor to handle local notifications and modify input components (TextField, DateTimeInput, Checkbox, Slider and MultipleChoice to use these local notifications for intermediate updates.

There was also a focus loss issue caused by Angular recreating components on every keystroke. It was fixed by updating the Renderer to reuse components via ComponentRef instead of re-creating them on every update.

Before

  • unnecessary network requests
unnecessary.network.requests.webm
  • focus loss
Focus.loss.webm

After

  • restaurant booking demo
booking.demo.webm
  • contact lookup streaming demo
streaming.demo.for.contact.sample.webm
  • full restaurant streaming demo:
Streaming.demo.for.restaurant.sample.webm

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Copy Markdown
Contributor

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

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 Angular components to directly update the local data model for immediate UI feedback, reducing network requests. It also optimizes the MessageProcessor to use a version signal for better change detection with in-place mutations and introduces a focus loss prevention mechanism in the Renderer by updating component inputs in-place when the component identity remains the same. Feedback includes a high-severity issue regarding an incorrectly formatted valueMap in multiple-choice.ts that could lead to incorrect data model updates, and a medium-severity suggestion to improve type safety in renderer.ts by using a more specific type for componentRef.

@nan-yu nan-yu merged commit 05df08a into google:main Mar 25, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 25, 2026
@nan-yu nan-yu deleted the client branch March 25, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants