Re-validate project field when item is selected
What does this MR do and why?
This MR fixes the bug in the agent form where the project validation error does not clear after a project is selected.
GlCollapsibleListBox in gitlab-ui emits a select event, SingleSelectDropdown listens for the select event and emits an input event, and FormProjectDropdown listens for input and emits input. I created a method in AiCatalogAgentForm that validates the project field when an item is selected (detected via the input event).
A second approach I considered:
- Looking at the code in gitlab-ui, I saw that
GlCollapsibleListboxdoes emit an eventhiddenwhen the listbox is closed - I thought about using the
hiddenevent to makeFormProjectDropdownemitblurto trigger validation
However, I thought this approach seems cleaner and modifies less files (since I'd have to pass the event along several components). But I'd like some thoughts on if the second approach better fits established patterns.
Screenshots or screen recordings
Screen_Recording_2025-12-03_at_10.34.41_AM
How to set up and validate locally
Test behaviour before change
- Try to submit the agent form without selecting a project and it will display an error that a project is required
- Select a project and the error will still be visible
Test behaviour after change (while on my feature branch)
- Try to submit the agent form without selecting a project and it will display an error that a project is required
- Select a project and the error will clear
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #575812 (closed)