-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Feature Request
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
IllegalStateExceptionif 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.
References
- Related PR: Drop React FAB dependency by replacing ReactAdapter with vanilla component #58
- Review comment: Drop React FAB dependency by replacing ReactAdapter with vanilla component #58 (comment)
- Requested by: @mlopezFC
Metadata
Metadata
Assignees
Labels
Type
Projects
Status