You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prevent instantiating more than one ChatAssistant per UI #59
It is not the intended design of the add-on to have two ChatAssistant instances loaded at the same time on the same page/UI. This should be enforced at the component level to prevent misuse and avoid subtle bugs (e.g., shared global state in client-side listeners).
Problem
Currently, nothing prevents a developer from adding multiple ChatAssistant instances to the same Vaadin UI. This can lead to unexpected behavior, including conflicts in client-side JavaScript markers (e.g., document[flag] collisions) and overlapping event listeners.
Proposed Solution
Add a guard in ChatAssistant that checks whether an instance is already registered for the current Vaadin UI and either:
Throws an IllegalStateException if a second instance is attached, or
Logs a warning and prevents initialization of the duplicate.
This check could be implemented in the onAttach lifecycle method by storing a UI-scoped reference.
Activity
Totremont commentedon Aug 24, 2026
Implemented by #72