Skip to content

Emit filter input clear event from GlFilteredSearch

Summary

Currently GlFilteredSearch component only emits submit event when user has some token values provided and either clicks Search button, or hits Enter/Return key while cursor is in input field. However, submit event is not emitted when user clears the filtered input field, this is specifically a requirements in case of filtered search as it is a more advanced component (compared to plain input field with clear button) as any page that has data filtered based on filters provided, clearing the input needs to refetch the unfiltered data. First use-case of this feature is in Requirements page where we're using GlFilteredSearch (see gitlab-org/gitlab!32961 (merged) & gitlab-org/gitlab!33484 (merged)).

We can make the component either emit submit event (with empty value) or clear event in case user clicks on Clear button to clear the filter values.